How do I use Sysprep to create a Windows XP image?

Deploying Windows XP on a large number of workstations can become a tiresome chore, but you can help speed the process along using Sysprep.

By Diana Huggins

There are many different methods an administrator can use to automate the installation of Microsoft Windows XP. One of the most popular and efficient methods is referred to as disk duplication where a preconfigured operating system is cloned and copied onto another computer. This method is an ideal choice when you need to install Windows XP on a number of systems that all require an identical configuration.

The System Preparation Tool (Sysprep), included with Windows XP, can be used to clone a computer and automate the deployment of the operating system. In this article, I will outline how you can use Sysprep to perform disk duplication.

This blog post is also available in PDF format in a TechRepublic download. This blog post was originally published as a TechRepublic article on September 14, 2005.

Introduction to Sysprep

One of the benefits of using disk duplication is that it makes installing an operating system, such as Windows XP, on multiple computers more efficient. It is a welcome alternative to manually installing the operating system on multiple computers and configuring identical settings. Instead, the operating system, any service packs, configuration settings, and applications can be included in the image and copied to the target machines.

The System Preparation Tool (Sysprep) included with Windows XP can be used to create the initial disk image. What Sysprep does is prepare the system running Windows XP to be duplicated. Once the image is created, you must then use a third-party utility to deploy it.

Using a utility like Sysprep offers several advantages. Although some time must be spent preparing the image, it will obviously speed up future installations as well as reduce the amount of user interaction required. The main disadvantage is that the reference computer and the target computers must have compatible Hardware Abstraction Layers (HALs) and identical Advanced Configuration and Power Interface (ACPI). The size of the hard disk on the destination computer must also be the same size or larger than the reference computer. All plug-and-play devices are redetected after Sysprep has run.

The general steps that must be completed when using disk duplication to deploy an operating system include:

  1. Install the operating system on the reference computer.
  2. Configure the reference computer as required.
  3. Verify that the reference computer is properly configured.
  4. Prepare the computer for duplication using Sysprep and create an optional Sysprep.inf answer file.
  5. Duplicate the image.

Preparing the reference computer

The first step in using Sysprep to create a disk image is to set up the reference computer. This entails installing the operating system, any service packs, software applications, and configuring settings that you want applied to the target computers. Once you've tested the image and are confident that it's configured the way you want it, you are ready to being the cloning process.

At this point, you are ready to run Sysprep. In order for the utility to function correctly, the Setupcl.exe file, the Sysprep.exe file, and the Sysprep.inf file must all be in the same folder. So your first step will be to create a Sysprep directory in the root folder of drive C on the reference computer. You can create the folder using Windows Explorer or the command prompt. With the second method, open the command prompt and change to the root folder of drive C. Type md Sysprep, as shown in Figure A, to create the new directory.

Figure A

You can create the Sysprep directory in the root folder of drive C from the command prompt.
Your next step will be to copy the files required to run the utility from the Windows XP CD to the Sysprep directory you just created. Insert the Windows XP CD into the CD-ROM drive. Open the file located in the Support\Tools directory and copy the Sysprep.exe file and the Setupcl.exe file into the Sysprep folder, as shown in Figure B.

Figure B

Copy the Sysprep.exe file and Setupcl.exe file into the Sysprep directory.

Running the Windows system preparation tools

After completing the steps outlined in the previous section, you are ready to launch the Sysprep utility to clone the reference computer. From the command prompt, change to the Sysprep directory and type in the following command:

Sysprep /optional parameter

Sysprep optional parameters include:

  • -quiet - Sysprep runs without displaying onscreen confirmation messages
  • -reboot - Forces the computer to automatically restart after Sysprep is complete.
  • -audit - Restarts the computer in Factory mode without having to generate new security IDs (SIDs).
  • -factory - Restarts the computer in a network-enabled state without displaying the Windows Welcome or mini-Setup. Use the parameter to perform configuration and installation tasks.
  • -nosidgen - The Sysprep.exe file is run without generating new SIDs. Use this parameter if you are not cloning the system.
  • -reseal - Prepares the destination computer after performing tasks in factory mode.
  • -forceshutdown - The computer is shut down after the Sysprep utility is finished.
Once you launch the utility, a warning message will appear. Click OK to acknowledge the warning, and the System Preparation Tool window appears, as shown in Figure C, allowing you to configure how the utility will run. The options available here can also be set using command-line switches when Sysprep is run from the command prompt as outlined above.

Figure C

The System Preparation Tool window allows you to configure how the utility will run.

Once Sysprep has successfully duplicated the reference computer and shutdown (remember the computer can be shutdown automatically by using the -reboot optional parameter), you can remove the hard disk and clone it using third party disk-imaging software.

When you restart a computer from a cloned disk for the first time, two events will occur. First, the Setupcl.exe file will start and generate a new SID for the computer. Second, the Mini-Setup Wizard will start, allowing you to customize the computer. You can also automate this event by creating and using a Sysprep.inf answer file, which is discussed in the section below.

The Sysprep.inf answer file

The first time a computer reboots after being cloned by Sysprep, a Mini-Setup wizard starts. The Mini-Setup wizard prompts the user for information to customize the installation on the target computer. However, if you want to automate the Mini-Setup wizard, you can use a Sysprep.inf file.

The Sysprep.inf file is similar to an answer file in that it contains configuration information that would normally be supplied by a user during the mini setup program. In order to use the sysprep.inf, it must be placed in the Sysprep folder or on a floppy disk. The first time the computer is restarted, it will automatically look for the sysprep.inf file.

Creating the answer file

Creating the Sysprep.inf answer file is not that difficult because a wizard will walk you through the entire process. The utility used to create the answer file is called Setup Manager. Conversely, if you are skilled in the area of answer files, you can also create one using a text editor such as Notepad.

Before you can use Setup Manager to create the answer file, it must first be installed on your computer. On the Windows XP CD, locate the Support\Tools directory. Open the file and copy the entire contents to a folder on your computer. Once the files have been copied, you can follow the steps outlined below to create an answer file.

1. Open the folder on your computer that contains the contents of the file and double-click Setupmgr.exe. The Windows Setup Manager Wizard will appear. Click Next.

2. Specify whether to create a new answer file or modify an existing one. If you want to modify one, you must enter the path to the file. Click Next.

3. From the Product to Install dialog box, shown in Figure D, select Sysprep Install. Click Next.

Figure D

Select Sysprep Install to create a Sysprep.inf answer file.

4. Select the platform that you will be using the answer file to deploy. You can select from Windows XP Home Edition, Windows XP Professional, and Windows 2000 Server, Advanced Server, or Data Center. Click Next.

5. Select the level of automation you want to use and click Next.

6. The next dialog box allows you to customize General Settings, Network Settings, and Advanced Settings, as shown in Figure E.

Figure E

The Windows Setup Manager allows you to customize various settings.

7. Once you have configured all the settings, click Finish.

8. Setup Manager creates the answer file and prompts you to choose a location to save the file. The file can be placed on a floppy disk or in the %systemdrive%\Sysprep directory.

9. Exit the Setup Manager application.

Once the Sysprep.inf answer file is created, you can open it using a text editor such as Notepad. The file may look something like the one shown below.

[Unattended]; Prompt the user to accept the EULA.OemSkipEula = No

;Use Sysprep's default and regenerate the page file for the system

;to accommodate potential differences in available RAM.

KeepPageFile = 0

;Provide the location for additional language support files that

;might be required in a global organization.

InstallFilesPath = c:\Sysprep\i386


;Set the time zone.

TimesZone = 20

;Skip the Welcome screen when the system starts.

OemSkipWelcome = 1

;Do not skip the Regional and Language Options dialog box so that users can

;indicate which options apply to them.

OemSkipRegional = 0


ComputerName = XYZ_Computer1


BitsPerPel = 16

XResolution = 800

YResolution = 600

VRefresh = 60


"%systemdrive%\sysprep\file name.bat" = "path-1\Command-1.exe""path-n\Command-n.exe""%systemdrive%\sysprep\sysprep.exe -quiet"[Identification]

;Join the computer to the domain ITDOMAIN.

JoinDomain = ITDOMAIN


When creating the Sysprep.inf file, there are a few things you need to keep in mind. After a Windows XP computer cloned using Sysprep restarts, the Mini-Setup program begins. It will automatically look for an answer file on a floppy disk or in the Sysprep directory.

The answer file must be named Sysprep.inf, otherwise the Mini-setup program will ignore the file. If an answer file is present, it is copied to the %windir%\System32 directory as $winnt$.inf. If no answer file is present, the Mini-Setup program will run interactively, prompting you for configuration information. Also, if any required sections are missing in the answer file, the program will switch to interactive mode and prompt you for the information.

That's all there is to it!

Disk duplication is a great way to reduce the amount of time it takes to install an operating system on multiple computers. The System Preparation Tool included with Windows XP can be used to prepare a reference computer to be cloned. To further automate the installation of Windows XP, you can use Setup Manager to create an answer file to be used with Sysprep. The answer file named Sysprep.inf contains the configuration information that would normally require user input during the Mini-Setup program.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!