A while ago I was experimenting with Packer to automate the creation and updating of my VMware Horizon master images. More details about this in a next post. During my testing however, I needed to clone a Windows VM and apply a customization to it using sysprep. If I tried that using Packer, I got the error “cannot complete customization”. The same error message appeared in the vCenter.

To be sure the sysprep.xml file I used was working, I ran the sysprep manually on the VM and that worked perfectly fine. So I was sure my sysprep.xml file was correct.

Next step was to create a customization profile in vCenter with my custom sysrep.xml and then manually try to clone a VM and customize it using this customization profile. I wasn’t really surprised that it failed with the same error as with Packer: “Cannot complete customization”.

So the search on Google began… However, not much information could be found. Most recommendations where to be sure the sysprep.xml file was working fine, but I already tested that part. I did found a (rather old) VMware KB from 2017 (https://kb.vmware.com/s/article/1032066) about this error, pointing me to the vpxd.log. The KB article stated it had something to do with the c:windowstemp folder that didn’t exist or had the wrong permissions, but that certainly wasn’t the case here.

I monitored the vpxd.log file (can be found on the vCenter appliance in /var/log/vmware/vpxd/) while doing another VM clone operation and at the time of the failure the following information showed up in the log:

2021-12-22T08:20:53.533+01:00 info vpxd[06543] [Originator@6876 sub=Default opID=kxfs78yr-10626-auto-878-h5:70005408-a6] [VpxLRO] -- ERROR task-1612375 -- vm-1600145 -- vim.VirtualMachine.clone: vim.fault.CustomizationFault:
--> Result:
--> (vim.fault.CustomizationFault) {
-->    faultCause = (vmodl.MethodFault) null,
-->    faultMessage = <unset>
-->    msg = ""
--> }

I asked Google about “vim.fault.CustomizationFault” but still nothing useful came up that helped me get this solved.

Then after taking a more in-depth look in the vpxd.log, I found some more information before the error I posted above:

2021-12-22T08:20:53.492+01:00 info vpxd[06543] [Originator@6876 sub=VmCustomizer opID=kxfs78yr-10626-auto-878-h5:70005408-a6-01] hostVersion = 7.0.2, Tools version = 11365
2021-12-22T08:20:53.492+01:00 error vpxd[06543] [Originator@6876 sub=VmCustomizer opID=kxfs78yr-10626-auto-878-h5:70005408-a6-01] Creating deploy pkg: N9GuestCust22SysprepConfigGenerator12MissingParamE(command: guestcustutil.exe restoreMountedDevices)
2021-12-22T08:20:53.492+01:00 error vpxd[06543] [Originator@6876 sub=VmProv opID=kxfs78yr-10626-auto-878-h5:70005408-a6-01] Get exception while executing action vpx.vmprov.CustomizeVm: N3Vim5Fault18CustomizationFault9ExceptionE(Fault cause: vim.fault.CustomizationFault
--> )

When searching for the above cryptic error “N9GuestCust22SysprepConfigGenerator12MissingParamE”, I came upon another VMware KB (https://kb.vmware.com/s/article/2151684) that doesn’t really has the same symptoms described as I have, but did tell me I needed to add some specific VMware related commands in my sysprep.xml file:

<settings pass="specialize">
  <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <RunSynchronous>
      <RunSynchronousCommand wcm:action="add">
        <Path>C:sysprepguestcustutil.exe restoreMountedDevices</Path>
        <Order>1</Order>
      </RunSynchronousCommand>
      <RunSynchronousCommand wcm:action="add">
        <Path>C:sysprepguestcustutil.exe flagComplete</Path>
        <Order>2</Order>
       </RunSynchronousCommand>
       <RunSynchronousCommand wcm:action="add">
         <Path>C:sysprepguestcustutil.exe deleteContainingFolder</Path>
         <Order>3</Order>
       </RunSynchronousCommand>
    </RunSynchronous>
  </component>
</settings> 

You need to add some commands to the sysprep.xml file to be able to use it as a VMware customization profile. If they are missing, the customization doesn’t work. Don’t worry about the executable itself (guestutil.exe), that is placed there by VMware, you just need to add the commands to your sysprep.xml file.

Adding those commands made my customization work fine both from within vCenter and with Packer!

Conclusion

I wrote this blogpost mostly because at first, the only error message you get to see is “cannot complete customization” and looking for that error on the Internet doesn’t seem to reveal the solution to my issue. Hopefully, you came here, looking for that error message and it helped you way faster than I figured this out 😉.


The post Cannot complete customization… appeared first on MickeyByte IT Pro Blog.

The original article was posted on: itpro.peene.be

Related articles

  • Cloud Native
  • Application Navigator
  • Kubernetes Platform
  • Digital Workspace
  • Cloud Infrastructure
  • ITTS (IT Transformation Services)
  • Managed Security Operations
  • Multi-Cloud Platform
  • Backup & Disaster Recovery
Visit our knowledge hub
Visit our knowledge hub
Michiel Peene Virtualization Consultant

Let's talk!

Knowledge is key for our existence. This knowledge we use for disruptive innovation and changing organizations. Are you ready for change?

"*" indicates required fields

First name*
Last name*
Hidden