Q: How can I configure my virtual machine (VM) template to set the product key automatically?
A: If you're using VM templates, the easiest way to specify the product key is by using something like System Center 2012 Virtual Machine Manager, which can inject whatever product key you need as part of the template. However, if you want to configure the product key outside of a management solution, you can use an answer file.
Below is a very basic answer file that specifies the Key Management Service (KMS) key forDatacenter:
48HP8-DN98B-MYWDG-T2DCC-8W83P OnError true
I save this as unattend.xml in a folder on the machine that will be SYSPREP'd as c:\unattend\unattend.xml.
I then run sysprep, passing this file. For example:
c:\windows\system32\sysprep\sysprep /generalize /shutdown /oobe /unattend:c:\unattend\unattend.xml
When the template is used, there will be no prompt for the product key. In the past, keys were set as part of the specialist phase, for example: