Sysprep (Generalize) a Windows installation
Before you can deploy a Windows image to new PCs, you have to first generalize the image. Generalizing the image removes computer-specific information such as installed drivers and the computer security identifier (SID). You can either use Sysprep by itself or Sysprep with an unattend answer file to generalize your image and make it ready for deployment.
Generalize a Windows installation
On a generalized Windows image, Windows Setup processes settings in the generalize configuration pass.
Even if you're capturing an image that's going to be deployed to a PC with similar hardware, you still have to generalize the Windows installation to remove unique PC-specific information from a Windows installation, which allows you to safely reuse your image.
When you generalize an image, Windows replaces the computer SID only on the operating system volume where you ran Sysprep. If a single computer has multiple operating systems, you must run Sysprep on each operating system individually.
Prevent Sysprep from removing installed devices
When you set up a Windows PC, Windows Setup configures all detected devices. Generalizing a Windows installation uninstalls these configured devices, but doesn't remove device drivers from the PC.
If you're deploying an image to computers that have identical hardware and devices as the original PC, you can keep devices installed on the computer during system generalization by using an unattend file with Microsoft-Windows-PnpSysprep |
PersistAllDeviceInstalls set to true. For more information about Sysprep-related Windows unattend components, see the Unattended Windows Setup Reference for Microsoft-Windows-PnpSysprep.
Limits on how many times you can run Sysprep
You can run
Sysprep command up to 1001 times on a single Windows image. After running Sysprep 1001 times, you must recreate your Windows image. Refer the following table:
|Operating System Version||Sysprep Count Limit|
|Windows 8.1 and Windows Server 2012 or later||1001|
|Windows 7 and Windows Server 2008 R2||3|
|Windows Server 2008||3|
In previous versions of Windows, you could use the
SkipRearm answer file setting to reset the Windows Product Activation clock when running Sysprep. If you are using a volume licensing key or a retail product key, you don't have to use
SkipRearm because Windows is automatically activated.
Microsoft Store apps
Installing new Microsoft Store apps or updating your existing Microsoft Store apps before generalizing a Windows image will cause Sysprep to fail.
Sysprep /generalize requires that all apps are provisioned for all users; however, when you update an app from the Microsoft Store, that app becomes tied to the logged in user account. The following error appears in the Sysprep log files (which you can find at
<package name> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
Instead of using the Microsoft Store to update your apps, you should sideload updates to your line-of-business apps, provision offline-licensed Microsoft Store for Business apps for all users, or have end-users update their apps by using the Microsoft Store on their destination PCs. If Microsoft Store access in a managed environment is disabled by an IT administrator, end-users will not be able to update the Microsoft Store apps.
For more information about sideloading line-of-business Microsoft Store apps, see Sideload Apps with DISM and Customize the Start Screen.
Generalize an image
Generalize from Audit Mode
To generalize an image, you have to first boot into Audit Mode. You can boot into Audit Mode using an unattend file or from the Out-Of-Box Experience (OOBE) screen. You can read about the different ways of booting into Audit Mode at Boot Windows to Audit Mode or OOBE.
Boot a PC into Audit Mode. When Windows boots into Audit Mode, System Preparation Tool will appear on the desktop. You can choose to either close the System Preparation Tool window or allow it to remain open.
Customize Windows by adding drivers, changing settings, and installing programs. Don't install any Microsoft Store apps using the Microsoft Store.
If the System Preparation Tool window is still open, click Generalize, click Shutdown, and then click OK to generalize the image and shut down the PC.
Run Sysprep from Command Prompt. Run
%WINDIR%\system32\sysprep\sysprep.exeto open the System Preparation Window. You can also use the
Sysprepcommand together with the /generalize, /shutdown, and /oobe options. See Sysprep command-line options to see available options.
%WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe
If you are generalizing a VHD that will be deployed as a VHD on the same virtual machine or hypervisor, use the
/mode:vmoption with the Sysprep command-line.
The computer generalizes the image and shuts down.
After the computer shuts down, capture your image with DISM.
Deploy this image to a reference computer. When the reference computer boots, it displays the OOBE screen.
Generalize using unattend
If you use multiple unattend files during your computer deployment, you can add the following settings to your each of your unattend files so Windows Setup will generalize the PC after processing the unattend file.
- To automatically generalize the image and shut down, use the Microsoft-Windows-Deployment | Generalize setting. Set
Modeto OOBE or Audit, and set
- To generalize the system, and have it boot into Audit Mode, use the [Microsoft-Windows-Deployment | Reseal(/windows-hardware/customize/desktop/unattend/microsoft-windows-deployment-reseal) setting to the oobeSystem configuration pass. Set
Sysprep Support for Server Roles