PowerCLI

 View Only
Expand all | Collapse all

OS Customization Error

  • 1.  OS Customization Error

    Posted Jun 24, 2014 07:11 PM

    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.



  • 2.  RE: OS Customization Error

    Posted Jun 25, 2014 05:17 AM

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



  • 3.  RE: OS Customization Error

    Posted Jun 25, 2014 12:16 PM

    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.



  • 4.  RE: OS Customization Error

    Posted Jun 25, 2014 12:19 PM

    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.



  • 5.  RE: OS Customization Error

    Posted Jun 25, 2014 01:28 PM

    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.



  • 6.  RE: OS Customization Error

    Posted Jun 25, 2014 02:31 PM

    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.



  • 7.  RE: OS Customization Error

    Posted Jun 25, 2014 06:13 PM

    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\*



  • 8.  RE: OS Customization Error

    Posted Jun 25, 2014 07:48 PM

    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?



  • 9.  RE: OS Customization Error

    Posted Jun 25, 2014 07:59 PM

    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.



  • 10.  RE: OS Customization Error

    Posted Jun 25, 2014 08:03 PM

    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.



  • 11.  RE: OS Customization Error

    Posted Jun 25, 2014 08:17 PM

    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.



  • 12.  RE: OS Customization Error

    Posted Jun 25, 2014 08:33 PM

    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 specification error



  • 13.  RE: OS Customization Error

    Posted Sep 06, 2014 09:58 PM

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



  • 14.  RE: OS Customization Error

    Posted Sep 08, 2014 01:47 PM

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



  • 15.  RE: OS Customization Error
    Best Answer

    Posted Sep 08, 2014 09:13 PM

    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



  • 16.  RE: OS Customization Error

    Posted Sep 08, 2014 09:51 PM

    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?



  • 17.  RE: OS Customization Error

    Posted Sep 08, 2014 09:53 PM

    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



  • 18.  RE: OS Customization Error

    Posted Sep 08, 2014 10:01 PM

    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>



  • 19.  RE: OS Customization Error

    Posted Sep 08, 2014 10:03 PM

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



  • 20.  RE: OS Customization Error

    Posted Sep 08, 2014 10:21 PM

    Thank you. Not as secure as what I would like, but that did solve it. It still leaves me to wonder why it works correctly in my Production environment without this work around.



  • 21.  RE: OS Customization Error

    Posted Jun 25, 2014 12:58 PM

    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.