In previous episodes of Dr. Unattend, you learned how Windows Vista's setup can be automated using unattend answer files. You also learned how to create and validate a simple unattend answer file using Windows System Image Manager (WSIM) that pumps support information into the System Control Panel.
Now you must be wondering: “This is great, I can use an unattend answer file to launch a ‘clean install’ that automates different parts of setup. But what if I already have an installation of Windows Vista that I have customized? Can I capture the image so it can be deployed on any PC?”
Yes! 
This is possible using two great tools: sysprep and ImageX. According to the Windows Administrative Installation Kit (WAIK) documentation, “The System Preparation (Sysprep) tool prepares an installation of Windows for duplication, auditing, and customer delivery. Duplication, also called imaging, [using ImageX in this case] enables you to capture a customized Windows image that you can reuse throughout an organization.”
So in other words, sysprep can ‘generalize’ a system by removing machine-specific information, files and registry settings from it. Of course, the first thing that happens after a computer is generalized and reboots is that setup kicks off the ‘specialize’ pass that puts all the machine-specific information back in! If you could capture the image of the hard-disk right before specialize pass of setup happens, you would have an image that could be deployed on almost any computer. Here's a hint: what's uber-cool about sysprep is that not only can it instantiate several different passes of setup, it can also pass an unattend answer file to setup. Try out sysprep /? for more information.
NOTE: Running sysprep clears away machine-specific information from your PC. For example, it forces Windows Welcome to start again and it also unjoins a PC from a domain. Make sure you read about sysprep in the WAIK before trying these steps:
1. Lets assume you have a deployment share called \\deployment on a PC other than the one being imaged. Underneath this share, create two folders: bin and images. In the bin folder, copy ImageX binaries from C:\Program Files\Windows AIK\Tools\x86. Make sure you have read access to the bin folder and read-write access to the images folder. The images folder should ideally have 10 GB of free space to accommodate a large image.
2. On the PC to be imaged, click Start
3. Type cmd and press CTRL+SHIFT+ENTER to launch an elevated command prompt
4. Type cd %windir%\system32\sysprep and press ENTER
5. Type sysprep /generalize /oobe /reboot and press ENTER
6. When the PC reboots, boot into Windows PE. For example, if you are connected to a WDS server, press F12 on boot and shows ‘Windows PE’ as the boot option. You can also boot to Windows PE from a Windows PE DVD.
7. Type net use * \\deployment and press ENTER. Lets say the share is now mapped to drive Z:
8. Type imagex /capture c: z:\images\install.wim "Drive C" /verify and press ENTER. Imaging may take a couple of hours depending on how many files are on the source drive.
Here's an overview of the workflow:

Now you can deploy this image to any computer, either by using imagex /apply or by using an unattend answer file to point setup to this image! In the next installment of Dr. Unattend, we'll visit another favorite tool of mine - Package Manager.