Sysprep is a Windows System Preparation Tool that prepares an installation of a running Windows for duplication, auditing and customer delivery. It enables you to capture a customized Windows image that you can reuse throughout an organization. A typical Sysprep process consists of the following steps:
- Install a Windows on a reference computer with all latest device drivers and updates.
- Install all other necessary applications and make all the customized changes.
- Once all done, run the command
sysprep /oobe /generalize
.- The
/oobe
option instructs the Windows system to run Windows Welcome the next time the computer boots, giving an Out-of-Box Experience. - The
/generalize
option tells Sysprep to remove system-specific data from the Windows installations.
- The
- After the reference computer shuts down, you can boot to Windows PE on the same computer, and capture the Windows installation with ImageX. We actually have a post that you can refer to for details.
The Sysprep command is located in the following path:
C:\Windows\System32\Sysprep
You can either double-click the sysprep.exe executable file to launch it directly with a GUI like below:
or use it as a command line with a number of switches available.
One of the switches, /mode, is new since Windows 8 that generalizes an image that can be deployed in a virtualized environment. Let’s say you have prepared a reference computer as a VM in Hyper-V, to Sysprep it, run the following command inside the VM to .
Sysprep /generalize /oobe /mode:vm
The only additional switches that apply to VM mode are /reboot, /shutdown, and /quit.
Note #1: It works the best when deploying the VHD to a different VM with a matching hardware profile.
Note #2: While it’s stated that it works for VHD in Hyper-V environment, it should also work with VMware as well.
Note #3: You can’t deploy the /mode:vm
prepared image to a physical machine.
its also could be “reg add “HKLM\SOFTWARE\Microsoft\DesiredStateConfiguration” /v AgentId /t REG_SZ /d “” /f”