I'm trying to create a Windows 2012 sysprepped image that I can boot from script, for creating automated test environments, and finding myself a little confused.
My understanding was that I could sysprep the box using this syntax:
C:\>sysprep /generalize /oobe /shutdown /unattend:A:\unattend.xml
Then, by modifying the appropriate unattend.xml and storing it in a FAT12 image mounted as drive A:, the server would use those modified settings during first boot to set the Administrator password, etc.
Thing is, it doesn't seem to work... and I suspect I may have got it completely backwards.
Does the /unattend parameter to sysprep tell sysprep 'hey, this is where you should read your settings when you first boot', or does it say 'hey, here are some settings you should bake into your sysprepped state and then use them next time you boot' ?
In other words, can I modify unattend.xml AFTER running sysprep but BEFORE I first boot the system? And if so, can I read the modified unattend.xml from a separate device (virtual floppy drive), or do I need to find and modify something stored within the sysprepped virtual machine image?
First, if you ran that sysprep command, then the unattend file that you specified has been cached for use upon first boot. Changing the file on the A: drive will make no difference at this point.
The Generalize pass is used when you run Sysprep (you specified the /generalize switch). The only other passes that might run at that time are the AuditSystem and AuditUser passes if you were using the /audit switch. However the /audit switch is not used on the final Sysprep run, but to boot to audit mode to make customizations.
The rest of the passes are used upon first boot. Please see the TechNet article ‘How Configuration Passes Work’ for more details.
To use a different file upon first boot can be a bit more challenging, since Sysprep cached the files when you ran it. The TechNet article ‘Methods for Running Windows Setup’ has a good description of the difference between ‘Explicitly Specifying an Answer File’ and ‘Implicitly Searching for an Answer File’. In the Implicit answer file search order table, it shows a registry entry that could be used to force setup to look to another answer file upon first boot, however you would have to mount the image with DISM (which has replaced ImageX) and make those changes offline.
You may want to look into using the Microsoft Deployment Toolkit (MDT) for your deployments. It is a Task based deployment solution that creates and uses answer files for you. You can use your sysprepped image and deploy it with the settings you specify in your task sequence. Multiple task sequences can use the same base image. There are other benefits too, such as managing device drivers and installing software. MDT automates a lot of the processes that you are doing manually. And it’s free.
This is a great video to show you how powerful and easy MDT can be:
Deployment Day Session 1: Introduction to MDT 2012
Hope this helps,