VMware Cloud Community
cramsey1986
Contributor
Contributor
Jump to solution

OS Customization Error

I have a script that I run againt my Production and Development Environments to automate the build of servers from a template.

The code is:

$vcenter = Connect-VIServer $vcenterName

$vHost = Get-VMHost -Name $vmHost
Get-OSCustomizationSpec -Name $osCustomization | New-OSCustomizationSpec -Name "oscustTEMP" -Type NonPersistent
Get-OSCustomizationSpec -Name "oscustTEMP" | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $ipAddress -SubnetMask $subnetMask -DefaultGateway $defaultGateway -Dns $dns
$vTemplate = Get-Template -Name $vmTemplate
$vDatastore = Get-Datastore -Name $vmDatastore
$vFolder = Get-Folder -Name $vmFolder


New-VM -Name $vm -Template $vTemplate -OSCustomizationSpec "oscustTEMP" -Location $vFolder -VMHost $vHost -Datastore $vDatastore -Confirm:$false
Start-VM -VM $vm -RunAsync

Disconnect-VIServer $vcenterName -Confirm:$false

When I run this against Production Environment the VM builds fine, but when I run it against my Development Environment and after the vim.event.CustomizationSucceeded I get the following error on the VM:

"Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [oobeSystem]. The settigns specified in the answer file cannt be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup]."

However, when I manually do a deploy from template and select the same OS Customization I do not get the above error and it works. It seems as if it may be an issue with the New-OSCustomizationSpec?

Any assistance would be greatly appreciate, please let me know if I need to supply any more details. Both environments are vCenter 5.1., 1123961.

0 Kudos
1 Solution

Accepted Solutions
gauravsingh85
Enthusiast
Enthusiast
Jump to solution

i think i found the problem

in the error screen if you press shift+F10 you will go to cmd prompt from there browse to c:\windows\partner and open unattended.xml . i found that the password clear text was marked true but password actually was in encrypted form . the work around was . export the custSpec change the password to clear text and mark the header as true and run the customization again . I hope this will solve your problem . it worked for me

View solution in original post

0 Kudos
20 Replies
LucD
Leadership
Leadership
Jump to solution

Did you already check file C:\WINDOWS\TEMP\customize-guest.log  on the guest for additional information ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

Thank you for your response LucD.

I am unable to check anything on the guest. After I click OK to the error, I get the following error: "Windows could not complete the installation. To install Windows on this computer, restart the installation."

If I click OK to that, the server will reboot, and then bring me back to the same error.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can try to shutdown the VM and then mount the VMDK on another VM.

From there you should be able to browse the filesystem and check the log file.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Zsoldier
Expert
Expert
Jump to solution

Are the templates the same version of Windows?  Usually that error has to do w/ the CustomSpec being made for Windows 2012, but template is 2003 or vice versa.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

LucD - I will give that a try.

Zsoldier - The template in the development environment was cloned from the template in the production environment. Both are Windows 2012.

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

LucD -

Ok. I have mounted that VMDK to another VM, but do not see a C:\WINDOWS\TEMP\customize-guest.log file. There is a C:\WINDOWS\TEMP\VMware-cust-nativeapp.log file. I do not see any errors in that file though.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you check all these logs and files ?

c:\windows\temp\vmware-imc\*

c:\windows\setup-act.log

c:\windows\setup-err.log

c:\windows\debug\*


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

Thanks again for your response. I looked into those logs, unfortanatley there is nothing sticking out as an Error or Failed Event.

Would there be anything on the vCenter servers themselves that are used to perform this OS Customization process?

0 Kudos
juriskrumins
Enthusiast
Enthusiast
Jump to solution

You can use Windows SIM which is a part of Windows ADK and try to validate your C:\Windows\Panther\unattend.xml file if you can get the it from VMDK file. By the way you can also compare it with the xml file used by sysprep in your production environment.

0 Kudos
snoopj
Enthusiast
Enthusiast
Jump to solution

Unless it's an error that's coming through in vCenter, it's usually limited to the OS that you are trying to customize.  The only errors I've ever used vCenter logs to troubleshoot have been related to the part right at the end of the template clone task where it creates the customization file for the VM and creates it out on the datastore for the VM to use when it powers on.  Specifically, that was in the vpxd.log file

By chance, does your 2012 image have KB2919355 installed in it?  I've seen plenty of recent postings about how VMware Tools needs to be reinstalled after this is installed to get guest customization working again.  Something sounds funny in the image itself.

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

Thank you for the suggestions.

juriskrumins - I have been comparing the xml from Development and Production, and the only difference I am noticing is in Production the "oobeSystem" is getting the tag "wasPassProcessed='true'" and in my Development environment it is not. I do also notice a blank line under <Password> and <AdministratorPassword> but otherwise the xml file functions normally.

Jon - The reason I ask about vCenter is because it is whats storing the OS Customization that I created and seems to be the only difference between working and not working. I am not familiar how the unattend.xml file is actually created for it to sysprep against.

I will check for that KB.

The other thing I am going to attempt is to compare the xml file from a manual deploy from the template using that same OS Customization.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Could this be the password problem that was seen before.

Most of the time creating a non-persistent OSCustomizationSpec fixed the issue.

See for example Re: Deploy VM's from Templates and Using Customizations That Require IP Info

and Re: Set-VM The vCenter Server is unable to decrypt passwords stored in the customization specificati...


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
gauravsingh85
Enthusiast
Enthusiast
Jump to solution

I am facing the same error while deploying VM from OSCustomization spec . Did you ever able to find out the solution to this problem ?

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

No. I have not found a solution for this yet.

0 Kudos
gauravsingh85
Enthusiast
Enthusiast
Jump to solution

i think i found the problem

in the error screen if you press shift+F10 you will go to cmd prompt from there browse to c:\windows\partner and open unattended.xml . i found that the password clear text was marked true but password actually was in encrypted form . the work around was . export the custSpec change the password to clear text and mark the header as true and run the customization again . I hope this will solve your problem . it worked for me

0 Kudos
cramsey1986
Contributor
Contributor
Jump to solution

I am glad you got yours working! When you say "export the custSpec change the password to clear text and mark the header as true" where are you referring to export it from?

0 Kudos
gauravsingh85
Enthusiast
Enthusiast
Jump to solution

export the customization spec to your desktop and edit it . remove the old customization spec from the vcenter and import the one you have edited

cramsey1986
Contributor
Contributor
Jump to solution

Ok, so do the following and re-import:

-<identity>

     <_type>vim.vm.customization.Sysprep</_type>

     -<guiUnattended>

          <_type>vim.vm.customization.GuiUnattended</_type>

          <autoLogon>true</autoLogon>

          <autoLogonCount>1</autoLogonCount>

          -<password>

               <_type>vim.vm.customization.Password</_type>

               <plainText>true</plainText>

               <value>[Enter Actual Password]</value>

          </password>

          <timeZone>20</timeZone>

     </guiUnattended>

gauravsingh85
Enthusiast
Enthusiast
Jump to solution

yes . dont forgot to delete the old spec from the vcenter before importing

0 Kudos