Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn, Powered by You.
you are not logged in





Site Services

Community Forums

Discussion Lists

Article Search


Web Blogs


Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us





Industry News:

  Home : Articles : Windows print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
Windows XP: Automating deployment using Sysprep

Bookmark and Share

By: Dan Thomson
Posted On: 3/31/2003

This article is geared toward illustrating the basic methods for duplicating the Windows XP Professional operating system across an organization using Microsoft’s Sysprep tool. If you already have a procedure defined for duplicating Windows 2000 using Sysprep, you'll be happy to know that the basic process of duplicating Windows XP has not changed much from what was introduced with the version of Sysprep that shipped with Windows 2000.

It is assumed that you have already configured a system that is ready for duplication. From here forward, this system will be referred to as the image master.

The Windows XP operating system duplication process requires the use of Sysprep version 2 that is included on the Windows XP distribution cd. The Sysprep tools are located in the <cdrom>\Support\Tools\ file.

Follow these steps to place the Sysprep files which are required for the duplication process on the image master hard drive:
  1. On the root of the %SystemDrive%, create a directory named Sysprep. Microsoft recommends not placing the Sysprep files on a drive other than the %SystemDrive%.
  2. Extract the following files from the <cdrom>\Support\Tools\ file to the newly created Sysprep directory:


    Optionally, the Deploy.chm, Readme.txt and SetupMgr.chm files can also be extracted. These are help files that provide in depth information on the procedures for using Sysprep.
Sysprep can be started by double clicking Sysprep.exe and using the options defined in the GUI or the command line/batch file. To avoid duplicating some information, this article will only cover the basic command line options. Since most individuals reading this article will be using Sysprep to duplicate Windows XP within their own organization, this article will also be limited to discussing Sysprep running with the Mini-Setup Wizard and not Windows Welcome.

Sample command line for automating Sysprep:

Sysprep.exe -reseal -mini -quiet -pnp

This will start Sysprep in reseal & quiet mode and use the Mini-Setup wizard. Sysprep will also re-enumerate all Plug and Play devices.

Command line syntax for running Sysprep:


Do not reset the grace period for Windows product activation. Use this parameter only if you have activated the Windows installation in the factory.


Reboots the computer into Factory mode without generating new security IDs (SIDs) or processing any items in the [OEMRunOnce] section of Winbom.ini.
Only use this command-line option if the computer is already in Factory mode.


Populates all of the available mass storage devices into the [SysprepMassStorage] section.


Clears the critical devices database that is used by the [SysprepMassStorage] section in the Sysprep.inf file.


Restarts in a network-enabled state without displaying Windows Welcome or Mini-Setup. This option is useful for updating drivers, running Plug and Play enumeration, installing applications, testing, configuring the computer with customer data, or making other configuration changes in your factory environment. For companies that use disk imaging (or cloning) software, Factory mode can reduce the number of images required.
When you have finished your desired set of tasks in Factory mode, run Sysprep with the -reseal option to prepare the computer for end-user delivery.


Shuts down the computer after Sysprep.exe finishes.

Use this parameter with computers with an ACPI BIOS that do not shut down properly with the default behavior of Sysprep.exe.


Configures Windows XP Professional to use mini-Setup rather than Windows Welcome. This parameter has no effect on Windows XP Home Edition, where the first-run experience is always Windows Welcome.

Note that if you plan to use sysprep.inf to automate the mini-setup portion, you must either run sysprep with the -mini switch, or click to select the MiniSetup check box in the GUI interface. If you do not choose to run MiniSetup, Windows XP Professional runs the Windows Welcome by default.


Modifies registry keys (SID, OemDuplicatorString, and so on) without the system rebooting or preparing for duplication. This option is mainly used for testing, specifically to see if the registry is modified properly. This option is not recommended because making changes to a computer after Sysprep has run may invalidate the preparation done by Sysprep. Do not use this option in a production environment.


Runs Sysprep.exe without generating new SIDs. You must use this parameter if you are not duplicating the computer on which you are running Sysprep.exe or if you are preinstalling domain controllers.


Runs the full Plug and Play device enumeration and installation during mini-Setup. This command-line parameter has no effect if the first-run experience is Windows Welcome.

Use -pnp only when you need to detect and install legacy, non-Plug and Play devices. Do not use sysprep -pnp on computers that only use Plug and Play devices. Otherwise, you will increase the time required for the first-run experience, without providing any additional benefit to the user.


Runs Sysprep.exe without displaying onscreen confirmation messages. This is useful if you are automating Sysprep.exe. For example, if you plan to run Sysprep.exe immediately following unattended Setup, add sysprep -quiet to the [GuiRunOnce] section of the Unattend.txt file.


Forces the computer to automatically reboot and then start Windows Welcome mini-Setup, or Factory mode, as specified. This is useful when you want to audit the computer and verify that the first-run experience is operating correctly.


Clears the Event Viewer logs and prepares the computer for delivery to the customer. Windows Welcome or Mini-Setup is set to start at the next boot. If you run the command sysprep -factory, you must seal the installation as the last step in your preinstallation process, either by running the command sysprep -reseal or by clicking the Reseal button in the Sysprep dialog box.

End command line syntax

On the next reboot after a system has had Sysprep run, the OS starts in a condensed version of the OS setup process called Mini-Setup. Normally, when Mini-Setup runs, it prompts the end user for a few standard pieces of information required to configure the computer, such as computer name, time zone and regional settings. To automate the Mini-Setup process, Microsoft provides an answer file named Sysprep.inf.

If Sysprep.inf is present, Mini-Setup uses the information it contains instead of prompting the end user. By using Sysprep.inf, you can have Mini-Setup prompt the end user for certain information, or it can be used to create a completely automated installation that does not prompt the end user for information at all.

The syntax of Sysprep.inf is similar to the unattended Setup answer file, Unattend.txt. Sysprep.inf supports a subset of the sections and entries supported by Unattend.txt plus a few Sysprep-specific entries.

The Sysprep.inf file must reside in the same location as Sysprep.exe and Setupcl.exe. As noted above, these Sysprep files should be placed in the %SystemDrive%\Sysprep folder on the hard disk of the destination computer.

Note: There is no parameter for specifying the mini-Setup Wizard answer file, it must be named Sysprep.inf.

Creating the Sysprep.inf file:

The Sysprep.inf file can be created using the Setup Manager tool or manually in a text editor.

A. Using Setup Manager (Setupmgr.exe) to create/edit Sysprep.inf:
  1. Start Setup Manager
  2. Click Next
  3. On this screen, you can choose to create a new Sysprep.inf or modify an existing Sysprep.inf. Choose the appropriate option and provide any required file information then click Next.

    Note: I find it odd that, even though the Sysprep answer file must be named Sysprep.inf, browsing for a file when using "Modify an existing answer file" defaults to text files.

  4. The Setup Manager now needs to know what type of answer file to create. Select Sysprep Install then Next.
  5. The Setup Manager also needs to know what OS this answer file is for. Select Windows XP Professional then Next.
  6. Should the installation be fully automated or not ? Select the appropriate option then Next.
  7. This next screen is where all the information about the install is entered.
  8. Starting off with Name (This is the registered user) and Organization, enter all appropriate information and click Next. Clicking Next will forward the wizard on to the next section. IE: The first time Next is selected, the wizard will move to the Display Settings section.

    The various sections and entries of Sysprep.inf are discussed later.

  9. When finished providing the relevant information. The Next button in the wizard changes to Finish. Select Finish to create/update the Sysprep.inf file.

    Note: The wizard seems to hang after clicking Finish. Just close the wizard by selecting File -> Exit.
B. Manually create/edit Sysprep.inf:

    This is usually required to add settings that are not configurable via Setup Manager.

  1. Using a text editor, open the sample Sysprep.inf file and modify it to meet the organizations needs.
  2. Save the modified file as a text file in the %SystemDrive%\Sysprep directory.

    Note: Back this file up to a safe location. It will be deleted when Sysprep runs.
Tips for installing Windows XP on the image master system

Install Windows XP on the image master computer. As a best practice, Microsoft recommends that Windows XP be installed from a distribution folder by using an answer file to help ensure consistency in configuring the master installation, so that iterative builds can be created and tested more readily. See Unattend.txt for information about automating Windows Setup using an answer file.

Log on to the computer as an administrator.
(Optional) Install and customize applications, such as Microsoft Office, Internet Explorer favorite items, and so on.
(Optional) Install any device drivers not included in and not installed by the answer file.
(Optional) Run audit tests.
(Optional) Create a Sysprep.inf

For information on automating Windows XP installations, see Deploying Windows XP Professional.

After Sysprep is finished running, the %SystemDrive%\Sysprep folder and its contents are deleted from the hard drive. If you want this folder to remain on the hard drive after running Sysprep, in the [Unattended] section of Sysprep.inf, set FactoryMode equal to Yes.

Prior to running Sysprep, be sure the following items have been reviewed:
  • The system is not a member of a domain.
  • The local administrator password is set blank.
  • If Sysprep is to be run on an NTFS file system partition that contains encrypted files or folders, the data in those folders will become completely unreadable and unrecoverable.
  • If the security permissions on files or in the registy are edited before running Sysprep, it must be verified that the "System" account has read/write permission in all security contexts. If not, the next time the computer starts, the operating system may fail.
Review of the various Sysprep.inf sections and entries

Specifies display settings for the graphics device. Supports the same set of entries as Unattend.txt.

Contains a list of commands to be executed the first time an end user logs on to the computer after GUI-mode Setup has completed. Supports the same set of entries as Unattend.txt.

This section is an ideal place to put commands that need to run after the Sysprep process. The commands can be items such as: Running OS updates, post imaging cleanup scripts, running a hard disk defragger, installing laptop specific software, etc.

Contains a core subset of the entries from the [GuiUnattended] section in Unattend.txt that are set during GUI-mode Setup plus a few additional entries which are specific to Sysprep.

Specifies the network identification entries of the computer. Supports the same set of entries as Unattend.txt.

Configures network capability. This section is required for configuring network protocols in unattended Setup or when using Sysprep. However, no entries are required within this section. The syntax is the same as in Unattend.txt.

Configures locale and language settings, provided the correct language files are available on the computer’s hard disk. For more information, see InstallFilesPath. Supports the same set of entries as Unattend.txt.

Automatically generates the entries in the [SysprepMassStorage] section.

Allows you to use the same image on computers with different mass-storage devices.

Includes the Telephony API (TAPI) entries. The values set in this section are only valid if a modem is present on the computer. Supports the same set of entries as Unattend.txt.

Contains a core subset of entries from the [Unattended] section in Unattend.txt plus a few additional entries which are specific to Sysprep.

Includes user-specific entries. Supports the same set of entries as Unattend.txt.

Begin sample Sysprep.inf

;<---The semi-colon tells Sysprep that this is a comment
;8=256, 16=High Color, 24= True Color (24 bit)
;32=True Color (32 bit)

;Add printer
Command0"rundll32 printui.dll,PrintUIEntry /in /n \\PrintServer\Printer"

;Leave blank or remove entry to be prompted for a password
;Enable Auto logon
;Auto logon specified number of times
;Add this description to the registry. This helps to determine
;which image was used on this system.
OEMDuplicatorstring="Image for the Engineering department."
;Skip regional settings page, they are defined below.
;Skip welcome screen...Better read about this one !
;Preset Timezone to Eastern Time (US & Canada)

;Specify whether to join a domain or workgroup
; JoinWorkgroup=MyWorkGroup
;Specify the OU which will contain the computer account.
;This must already exist.
MachineObjectOU="OU=WinXP, DC=MyDomain, DC=com"
;Specify account information which will be
;used to join the computer to the domain

;To install default networking components, set the value to Yes
;To install networking components as defined below,
;set the value to No










;Generate the entries in the [SysprepMassStorage] section
;from the Plug and Play hardware IDs specified in
;Machine.inf, Scsi.inf, Pnpscsi.inf, and Mshdc.inf.

;See Deploy.chm for information on adding additional drivers.

;This section is only valid if a modem exists

;Extend the partition ?
;0= Do not extend
;1= Extend partition to fill hard disk
;size= Extend partition by this amount
;Specifies the location of files which are required during Mini-Setup
; KeepPageFile=0 It doesn't work, don't use !
;Specifies the path to directories that contain drivers
;which are not distributed with
;max entry length = 4,096 characters
;Skip the EULA...Better read about this one !
;Sysprep resets the source path in the registry to the first cdrom.
;Use this switch to set it back to a local directory.
;Read Deploy.chm about updating the HAL's
;Specifies whether Plug and Play is called after Mini-Setup.
;Do not use when running Sysprep -pnp

FullName="Information Technology"
OrgName="My Corporation"
;Leave blank or remove entry to be prompted for a name
;Provide the product key...Better read about this one !

End sample Sysprep.inf

For help on creating a Sysprep.inf file that uses the [Networking] section(s), run Setup Manager and create an answer file for an Unattended Install that utilizes the Networking Components entries. The sections and entries relating to Networking can then be copied from the unattend.txt file into Sysprep.inf.

If the image is to be deployed to systems that have inconsistent hardware, the required drivers for all hardware that varies on the destination systems can be included in the image. I suggest placing all driver files in subfolders of the %SystemDrive%\Drivers directory and either use the PnPDriversPath entry in Sysprep.inf or manually add the driver paths to the DriverPath value located in the HKLM\Software\Microsoft\Windows\CurrentVersion\DevicePath regisrty key.

The %SystemDrive%\Drivers directory should contain all drivers which are not included on the Windows XP installation source (local path, distribution cd or network share) and are required during the duplication process.

Running commands during Sysprep

The Sysprep process allows additional commands to be run at the end of Mini-Setup and the first time the end user logs on to the computer after GUI-mode Setup runs.

A. Adding commands to be run at the end of Mini-Setup
  1. Create the following directory structure:


  2. Create a text file in the $OEM$ directory named Cmdlines.txt.
  3. Place required commands in the Cmdlines.txt file.

    The syntax for Cmdlines.txt is as follows:



    "command_1", "command_2", etc specify the commands you want to run (and in what order) when GUI-mode Setup calls Cmdlines.txt. Note that all commands must appear in quotation marks.

    The following limitations apply to Cmdlines.txt:

    1. When Cmdlines.txt runs, there is no logged-on user and no network connectivity. All user-specific information is written to the default user registry, and all subsequently created users inherit those registry settings.
    2. You must place the files necessary for an application or utility to run in the distribution folders.
    3. When you install applications by using Cmdlines.txt, install the application in unattended Setup mode so that the user does not need to respond to prompts about the application.
    4. You cannot install Windows Installer (.msi) applications using Cmdlines.txt. Use [GuiRunOnce] instead.
B. Adding commands to be run the first time the end user logs on to the computer after GUI-mode Setup runs
    Modify the Sysprep.inf file by adding required commands to the [GuiRunOnce] section.

    As shown below [GuiRunOnce] has a structure slightly different than Cmdlines.txt.

    Command0="\\FileServer\CheckState.exe" Command1="\\FileServer\FinalSetup.exe"

    Commands run using the [GuiRunOnce] section run in the context of the currently logged-in end user. If the end user does not have the permissions necessary to run the command completely, then the application fails. Because this is run in the context of a logged-in end user rather than as a service, the registry entries that the application creates are written for the current end user rather than the default user. (Default user registry settings are propagated to new end users.) If you want any settings and updates to show only for the specifically logged-in end user, then this might be appropriate. Otherwise, Cmdlines.txt is a better approach to running commands and installing applications because it runs as a system service.
  • This article is geared toward running Sysprep on Windows XP Professional. You should read the deploy.chm help file for information on duplicating a Windows server OS.
  • To get the sample files, download the attached file.
  • If you'd prefer to use RIS for deploying Windows, see Matt Goedtel's article series Using Remote Installation Service to deploy Windows images
  • If you are an OEM, there are additional tools available. See for more information.
For further information on using Sysprep to deploy Windows XP:If there are any suggestions or questions about this article, please post them in the Article Discussions forum. The Windows Workstation OS forum is also a good place to find assistance with Sysprep.

I can be reached at
I'll be happy to help.

Happy imaging `:-)


See my other articles.

P.S.: I would greatly appreciate ANY feedback on this article. ©2010 | Legal | Privacy