Introduction to Sysprep

Before you start

Objectives: learn what is Sysprep, where can you find it and what can you do with it.

Prerequisites: you should be familiar with general terms concerning automated Windows installation.

Key terms: sysprep, audit, parameter, generalize, oobe, reference


Location and Usage

System Preparation tool or Sysprep prepares a computer’s hard disk for disk duplication, auditing and customer delivery. In Windows Vista and 7, Sysprep is available in the %WINDIR%\system32\sysprep directory. When talking about XP, Sysprep is the part of Windows XP Deployment Tools, which we can find on XP installation CD in folder \support\tools, or which we can download from Microsoft site. Keep in mind that Sysprep for XP works a bit differently then the Sysprep for Vista or 7. For example, answer file for Sysprep in XP is named Sysprep.inf, and default name for answer file in Vista or 7 is Autounattend.xml.

Only users with administrator privileges can execute Sysprep and only one Sysprep instance can run at a time. The Sysprep utility must be used after the reference computer is completed and ready to be captured. Running Sysprep is the last step we take before capturing the reference computer. Sysprep will generalize the image and remove all hardware specific information, such as the computer SID. After deployment, Sysprep will detect the hardware of the target computer, generate a new SID and, if specified in answer files, name the computer, install drivers and customize the image without user intervention.

Sysprep Parameters

When the reference computer is ready to be captured, we can use the Sysprep command with certain parameters to prepare the image for capturing.

/audit Parameter

The /audit parameter enables the computer to start in Audit mode instead of the Windows Welcome mode. Audit mode is also known as Reseal mode. In audit mode we can add additional drivers, applications and test our image before capturing. When using an answer file we have to use the Microsoft-Windows-Deployment\Reseal\Mode=Audit option to enter Audit mode.

/generalize Parameter

The /generalize parameter prepares the image for installation by removing all unique system information such as computer name, logs, restore points and hardware specific information. We must run this option if we intend to transfer the image to a different computer. When Setup starts at the next reboot after the generalize pass, the specialize pass of the installation will occur (unless the system is configured to boot into Audit mode). When using an answer file, we have to use the Microsoft-Windows-Deployment\Generalize option.

/oobe Parameter

The OOBE parameter starts the computer to Windows Welcome or Out Of Box Experience mode. This allows a user to customize their system, such as creating accounts and setting the computer name. Many of these steps can be automated using an answer file. When using an answer file, we have to use the Microsoft-Windows-Deployment\Reseal\Mode=OOBE option.

/reboot and /shutdown Parameters

These two parameters specify what to do when Sysprep has completed its work. For example, if we are ready to take the image of the computer and we use the generalize command, we are going to use the /shutdown parameter. Also, if we are using audit mode to test Sysprep and to prepare it with adding additional software and drivers we would use a /reboot parameter.

/quiet Parameter

This parameter will suppress any on-screen messages when using an answer file to automate the installation process.

/quit Parameter

This parameter will close Sysprep once it is complete.

/unattend Parameter

If we are using an answer file we can specify the path to the file by using the /unattend followed by the path and filename of the answer file to use when Windows Setup resumes at the next restart. We use this option if we are using a custom answer file (not named Autounattend.xml or Unattend.xml) for a specific installation stage or a file in a location that is not searched automatically.

Running Sysprep

Several Sysprep switches can be used in the same command. For example, “c:\windows\system32\sysprep\sysprep.exe /generalize /shutdown“. If we run Sysprep without any command line options, Sysprep will run with a graphical interface. This allows us to pick and choose the actions we would like the Sysprep to perform, like choose the setup mode (OOBE or Audit mode), choose the generalize option and choose the shutdown option (quit, reboot, or shutdown).

Sysprep In Windows 7

Image 180.1 Sysprep in Windows 7

Example Procedure

First we have to install Windows on the reference computer using any method that we like. When the installation is complete we can restart our computer in Audit mode. To do that, at the Welcome Screen press Ctrl + Shift + F3. We could also use scripts or parameters in the answer file to restart the computer in Audit mode. In Audit mode we can add drivers and install applications that will be used by all computers that will use the system image. We can reboot the computer as many times as we like and it will continue to restart in Audit mode.

After we have finished setting up reference computer we can run Sysprep with the generalize, oobe, and shutdown options. To retain additional drivers that do not exist in the default driver store, we have to make sure the answer file includes the Microsoft-Windows-PnpSysprep\PersistAllDeviceInstalls option before running sysprep /generalize. Next, we have to boot the reference computer using WinPE, capture and save the image. Then we can use deployment tools to deploy (install) the image to the target computers.

To customize the image after it has been deployed to a target computer, for example to install drivers for the specific computer or install applications available only for users of that computer, we can again restart that computer in audit mode, make modifications and then again run Sysprep with the generalize, oobe, and shutdown options. When the installation and setup is finished, the Windows Welcome screen is shown, giving the user a chance to finish and customize the installation.

Remember

Sysprep prepares a computer’s hard disk for disk duplication, auditing and customer delivery. The /audit parameter enables the computer to start in Audit mode instead of the Windows Welcome mode. The /generalize parameter prepares the image for installation by removing all unique system information such as computer name, logs, restore points and hardware specific information. The OOBE parameter starts the computer to Windows Welcome or Out Of Box Experience mode. /reboot and /shutdown parameters specify what to do when Sysprep has completed its work. /quiet parameter will suppress any on-screen messages when using an answer file to automate the installation process. /quit parameter will close Sysprep once it is complete. /unattend parameter is used when we are using a custom answer file (not named Autounattend.xml or Unattend.xml) for a specific installation stage or a file in a location that is not searched automatically.

Paths that are mentioned in this article
  • %WINDIR%\system32\sysprep\ – location of the Sysprep in Vista or 7
  • %CD Drive%\support\tools\ – folder on XP installation CD where Deplyoment Tools are located
Commands that are mentioned in this article
  • c:\windows\system32\sysprep\sysprep.exe /generalize /shutdown – example command in which we used /generalize and /shutdown parameter. It is entered in CMD.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: