I was wondering if you could help me? I'm trying to deploy a windows server 2012R2 base image using the vsphere ansible module.

I have created a Vsphere template where the guest machine has WinRM enabled, as per the powershell script on the ansible windows documentation website. Using the vsphere ansible module I then deploy a new VM from this template and pass in a powershell script to the guest to kick start my configuration. The problem is, when I try and domain join this new VM in a powershell script, I get errors with the SID of the new vm. The vsphere template hasn't run sysprep.

What I have then done is run sysprep.exe /generalize /oobe /reboot before turning the machine off to create the vsphere template. Ansible is now deploying this template instead. However, when this new template deploys, it is greeted with the windows welcome screen which blocks ansible provisioning it. When I click passed this manually, ansible still dosnt seem to be able to talk to it, I believe winRM has somehow been disabled during the sysprep.

Has anyone managed to overcome this problem before? My feeling is that this must be a solved problem?

Any pointers and support welcome :)



You probably want to use the /shutdown switch instead of /reboot before make it into template, and you should give an /unattend:unattend.xml with preseeded answers for making a silent installation. Use setupcompleted.cmd to enable powershell and WinRM before first autologin/login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.