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

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : Scripting 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\Deploy.cab 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\Deploy.cab file to the newly created Sysprep directory:

    Setupcl.exe
    Setupmgr.exe
    Sysprep.exe

    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:

-activated

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

-audit

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.

-bmsd

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

-clean

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

-factory

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.

-forceshutdown

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.

-mini

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.

-noreboot

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.

-nosidgen

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.

-pnp

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.

-quiet

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.

-reboot

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.

-reseal

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 Drivers.cab 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

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

[GuiRunOnce]
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.

[GuiUnattended]
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.

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

[Networking]
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.

[RegionalSettings]
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.

[Sysprep]
Automatically generates the entries in the [SysprepMassStorage] section.

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

[TapiLocation]
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.

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

[UserData]
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
;SetupMgrTag
[Display]
BitsPerPel=24
;8=256, 16=High Color, 24= True Color (24 bit)
;32=True Color (32 bit)
Xresolution=1024
YResolution=768
Vrefresh=75

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

[GuiUnattended]
;Leave blank or remove entry to be prompted for a password
AdminPassword=
;Enable Auto logon
AutoLogon=Yes
;Auto logon specified number of times
AutoLogonCount=1
EncryptedAdminPassword=No
;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.
OEMSkipRegional=1
;Skip welcome screen...Better read about this one !
OEMSkipWelcome=1
;Preset Timezone to Eastern Time (US & Canada)
TimeZone=35

[Identification]
;Specify whether to join a domain or workgroup
; JoinWorkgroup=MyWorkGroup
JoinDomain=MyDomain
;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
DomainAdmin=MyDomain\Administrator
DomainAdminPassword=MyPassword
EncryptedDomainAdminPassword=No

[Networking]
;To install default networking components, set the value to Yes
;InstallDefaultComponents=No
;To install networking components as defined below,
;set the value to No
InstallDefaultComponents=No

[NetAdapters]
Adapter1=params.Adapter1

[params.Adapter1]
INFID=*

[NetClients]
MS_MSClient=params.MS_MSClient

[NetServices]
MS_SERVER=params.MS_SERVER

[NetProtocols]
MS_TCPIP=params.MS_TCPIP

[params.MS_TCPIP]
DNS=No
UseDomainNameDevolution=No
EnableLMHosts=Yes
AdapterSections=params.MS_TCPIP.Adapter1

[params.MS_TCPIP.Adapter1]
SpecificTo=Adapter1
DHCP=No
IPAddress=192.168.3.186
SubnetMask=255.255.255.0
DefaultGateway=192.168.3.1
DNSServerSearchOrder=192.168.3.1,192.168.3.2
WINS=Yes
WinsServerList=192.168.3.1,192.168.3.2
NetBIOSOptions=0

[RegionalSettings]
LanguageGroup=1
SystemLocale=00000409
UserLocale=00000409
InputLocale=0409:00000409

[SetupMgr]
DistFolder=C:\Sysprep\i386

[Sysprep]
;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.
BuildMassStorageSection=Yes

[SysprepMassStorage]
;See Deploy.chm for information on adding additional drivers.

[TapiLocation]
;This section is only valid if a modem exists
AreaCode=410
CountryCode=1
Dialing=Tone
LongDistanceAccess="9"

[Unattended]
;Extend the partition ?
;0= Do not extend
;1= Extend partition to fill hard disk
;size= Extend partition by this amount
ExtendOemPartition=0
;Specifies the location of files which are required during Mini-Setup
InstallFilesPath=C:\Sysprep\i386
; KeepPageFile=0 It doesn't work, don't use !
;Specifies the path to directories that contain drivers
;which are not distributed with Drivers.cab
;max entry length = 4,096 characters
OEMPnPDriversPath=Drivers\Audio;Drivers\Video
;Skip the EULA...Better read about this one !
OemSkipEula=Yes
;Sysprep resets the source path in the registry to the first cdrom.
;Use this switch to set it back to a local directory.
ResetSourcePath=C:\I386
;Read Deploy.chm about updating the HAL's
; UpdateHAL=ACPIAPIC_MP
; UpdateUPHAL=ACPIAPIC_UP
;Specifies whether Plug and Play is called after Mini-Setup.
;Do not use when running Sysprep -pnp
UpdateInstalledDrivers=No

[UserData]
FullName="Information Technology"
OrgName="My Corporation"
;Leave blank or remove entry to be prompted for a name
ComputerName=MyXPComputer
;Provide the product key...Better read about this one !
ProductKey=22222-22222-22222-22222-22222

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:

    %SystemDrive%\Sysprep\I386\$OEM$

  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:

    [Commands]
    "command_1"
    "command_2"
    .
    .
    "command_x"

    Where:

    "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.

    [GuiRunOnce]
    Command0="\\FileServer\CheckState.exe" Command1="\\FileServer\FinalSetup.exe"

    Notes:
    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.
Notes:
  • 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 7872XP_Sysprep.zip 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 oem.microsoft.com 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 dethomson@hotmail.com.
I'll be happy to help.

Happy imaging `:-)

Dan

See my other articles.

P.S.: I would greatly appreciate ANY feedback on this article.

  myITforum.com ©2010 | Legal | Privacy