Recently, on a professional services engagement, we encountered a situation, where the Customization Wizard was failing to successfully apply SYSPREP to Windows 2012 Servers. Because our main objective and my time was focused on other areas, we could not take time to resolve the underlying the root cause, so we needed a work-around. This led us to applying SYSPREP manually, which I had not done in a long time. Here are the details that we applied toward using SYSPREP manually in a VM template
Our main concern is if we deploy two VMs from a template or VM that already has a SID, then an issue may occur if we try to add both new VMs to the domain. The following error may occur when adding the second VM.
To fix this in the second VM, you can use these steps:
1 – Open RUN and enter sysprep
2 – Right-click on sysprep and choose Run as Administrator
3 – In the System Preparation Tool Window, set the System Cleanup Action dropdown = Enter System Out of Box Experience (OOBE). check the Generalize box, and set the Shutdown Options to Reboot.
4 – SYSPREP will run the necessary action and restart Windows.
5 – As Windows reboots, it will prompt for new Settings. Apply the appropriate settings for this VM. Windows will now have a new SID.
6. – After Windows starts, you should be able to successfully add it to the AD domain.
To avoid this issue in the future, deploy a Windows VMs from a template where SYSPREP has been used to strip the SID and where Windows will prompt for new settings on the next boot. To prepare the template, perform these steps:
- In a new VM, install Windows 2012 R2
- Install VMware Tools
- Install all Windows Updates
- Use Steps 1 to 3 from above, except on step 3, set the Shutdown Options = Shutdown (not restart)
- After Windows shutdown finishes, use the vSphere Client to right-click on the VM and choose Convert to Template