How Sysprep Works
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
How Sysprep Works
In this section
Sysprep Architecture
Sysprep Physical Structures
Sysprep Processes and Interactions
Related Information
The System Preparation tool (Sysprep) is a technology that you can use when performing an image-based installation. Image-based installation is a method of copying or cloning preconfigured operating systems and software applications onto destination computers. Image-based installation is the fastest method of installing an operating system and applications, and is typically used during large-scale rollouts when it would be too slow and costly to have administrators or technicians interactively install the operating system on individual computers.
These sections provide an in-depth view of how Sysprep works in an optimal environment. An optimal environment for Syprep contains the following:
Plug and Play hardware that is compatible with Windows Server 2003.
High-bandwidth network connectivity between the destination computers and the computer on which the disk images are stored.
Physical access to the destination computers.
BIOS and hardware that support starting from the floppy drive and the CD drive.
Disk-imaging software, such as a non-Microsoft disk-imaging program that is compatible with Microsoft Windows Server 2003 or Windows Server 2003 Automated Deployment Services (ADS).
Sysprep Architecture
Sysprep relies on several components, including three executable programs and several answer files. How these components interact with each other at the various stages of an image-based installation is illustrated in the following figure.
Sysprep Architecture
The Sysprep tool consists of three components: Sysprep.exe, Setupcl.exe, and Factory.exe. These components run on both the master computer — the computer on which you are creating your master installation — and the destination computer — the computer on which you are installing a disk image. The answer files (Cmdlines.txt, Sysprep.inf, and Winbom.ini) are created on a technician or administrator computer, and are used on the master computer and the destination computer when Sysprep and its associated components run. The disk imaging tool runs on the master computer, where it is used to create a disk image, and on the destination computer, where it is used to copy a disk image from a CD or a remote server onto the destination computer’s hard disk.
The following are components used in an image-based installation with Sysprep.
Cmdlines.txt
A configurable text file that you use to perform installation and configuration tasks at the end of the Mini-Setup stage. Cmdlines.txt contains a list of commands that run synchronously after the Mini-Setup stage finishes, but before a computer restarts.
Destination computer
Computer on which you are installing an operating system. For image-based installations, this is the computer to which you are copying a disk image. During a large-scale rollout, there can be typically hundreds or thousands of destination computers.
Disk image
Functionally identical replica of a hard disk that can be copied onto multiple computers. You need a disk imaging tool to create a disk image.
Disk-imaging tool
Program that creates and manages disk images. You use the disk-imaging tool on the master computer to create a disk image and save the disk image to a CD, DVD, or a remote server. You use the disk-imaging tool on the destination computer to copy the disk image from a CD, DVD, or remote server to the destination computer’s hard drive. You can purchase a non-Microsoft disk-imaging program to perform an image-based installation with Sysprep, but you can also use ADS.
Distribution server
Computer that contains the disk images you want to copy onto destination computers.
Factory.exe
Sysprep component that controls the Factory-mode stage of an image-based installation with Sysprep. You can configure Sysprep so that a destination computer starts in Factory mode. Factory mode puts a destination computer into a network-enabled state that allows you to perform installation and configuration tasks before you prepare the destination computer for final delivery to a user. Factory.exe must exist in the same folder on the master computer as Setupcl.exe and Sysprep.exe, which is typically the systemdrive\Sysprep folder.
Master computer
Computer from which a disk image is derived. A master computer contains a master installation, which is the system disk on which you have installed and configured the operating system and software applications that you want to install onto the destination computers in your organization.
Mini-Setup
A wizard that is a subset of Setup. Mini-Setup runs automatically after a disk image is copied to a destination computer and the destination computer is started. Mini-Setup provides prompts for user-specific information, configures operating system settings, and detects new hardware. You can automate the Mini-Setup stage by using Sysprep.inf.
Registry
Repository where Sysprep stores configuration and setup information prior to the disk imaging process. Sysprep reads the configuration and setup information from this repository the first time a destination computer starts after delivery to a user.
Setupcl.exe
Sysprep component that resets security identifiers (SIDs) on the master computer prior to running a disk imaging tool and creating a disk image of the master computer’s system disk. Setupcl.exe can also run at the end of the Factory-mode stage if you run Sysprep with the Factory mode option. Setupcl.exe must exist in the same folder on the master computer as Factory.exe and Sysprep.exe, which is typically the systemdrive\Sysprep folder.
Setup Manager
Deployment tool that creates a basic Sysprep.inf answer file. You use Setup Manager on the administrator or technician computer, and then transfer the answer file to the master computer prior to creating the disk image.
Sysprep.exe
Primary Sysprep component. You run Sysprep.exe on the master computer prior to running a disk-imaging tool to create a disk image. Sysprep.exe also runs automatically after you copy a disk image to a destination computer and then start the destination computer for the first time. Sysprep.exe can be run from the command line or it can be run in the Windows graphical user interface (GUI). Sysprep.exe must exist in the same folder on the master computer as Setupcl.exe and Factory.exe, which is typically the systemdrive\Sysprep folder.
Sysprep.inf
An answer file that can be used to automate the Mini-Setup stage.
Syssetup.dll
Dynamic-link library that performs installation and configuration tasks during the Factory mode stage and the Mini-Setup stage of an image-based installation with Sysprep.
Technician computer
Computer used by an administrator or technician to use Setup Manager or Notepad to create and modify answer files, such as Sysprep.inf and Winbom.ini.
Winbom.ini
An answer file that you can use to automate installation tasks when a computer is started in Factory mode. Factory mode is useful for updating drivers, running Plug and Play enumeration, installing applications, testing, configuring the computer with customer data, or making other configuration changes before you deliver a computer to an end user.
Winlogon.exe
A component of the Windows operating system that provides interactive logon support. Winlogon is designed around an interactive logon model that consists of three components: the Winlogon executable, a Graphical Identification and Authentication dynamic-link library (DLL) referred to as the GINA, and many network providers.
Sysprep Physical Structures
The structures of two files are essential to an image-based installation with Sysprep: the Sysprep.inf answer file, which automates the Mini-Setup stage of an image-based installation, and the Winbom.ini answer file, which automates the Factory-mode stage of an image-based installation. You can create the Sysprep.inf answer file by using Setup Manager (Setupmgr.exe) or you can create it manually by using a text editor, such as Notepad. You must create the Winbom.ini answer file manually by using a text editor, such as Notepad.
As with most answer files, Sysprep.inf and Winbom.ini contain multiple predefined sections — some mandatory and some optional — that you can modify. Section names are always enclosed in square brackets (for example, [Unattended]).
Every section has one or more entries that contain installation and configuration information. Entries are usually composed of an entry name, an equal sign, and a value (for example, ComputerName = Computer1
). The entry name represents a specific computer setting or action; the value represents the unique way you want the setting configured or the action performed. In some cases, entries do not have an entry name. In these cases, a value or a list of values (usually commands) appear in the answer file below a section name. The following example shows a section that contains only values and does not have entry names.
[GUIRunOnce]
dcpromo /answer:a:\installdc.txt
%systemroot%\cluster\cluster.exe
Use the following guidelines when you create or modify an answer file:
Sections do not have to be any particular order.
Sections and entries are not case sensitive.
Entries must have valid values. For example, “on” is not equivalent to “enable,” and “off” is not equivalent to “disable.” Invalid sections and entries can generate errors, or cause Setup to fail.
Each entry must have a value.
Each section and entry must appear on a separate line.
Comments must begin with a semi-colon (;).Do not use “REM” to specify a comment.
Note
- Do not modify undocumented sections or entries in an answer file; doing so can cause unpredictable results.
Sysprep.inf Structure
You can use Sysprep.inf to automate the Mini-Setup stage of an image-based installation. This corresponds to the final stage, or GUI-mode stage, of an interactive setup. The following table lists all of the valid sections that can appear in a Sysprep.inf file.
Answer File Sections for Sysprep.inf
Section | Description |
---|---|
[adapter_specific_protocol_section] |
Contains an entry for specifying a network component. Used in conjunction with the [Networking] section. |
[Display] |
Contains entries for specifying display settings for graphics devices. |
[GuiRunOnce] |
Contains commands to run the first time a user logs on to the computer after the Mini-Setup stage completes and the destination computer restarts. |
[GuiUnattended] |
Contains entries for configuring the way the Mini-Setup stage runs as well as time and date settings. . |
[Identification] |
Contains entries for specifying the network identification of a computer. If these entries are not present, Setup adds the computer to the default workgroup. If there is not enough information for this entry, Setup prompts the user to provide this information. |
[IEHardening] |
Contains entries for configuring Web content zones. |
[LicenseFilePrintData] |
Contains entries for installing licensing information for Windows Server 2003. |
[MS_AppleTalk parameters] |
Contains entries for configuring AppleTalk. |
[MS_ATMArps parameters] |
Contains no entries. |
[MS_ATMLANE parameters] |
Contains no entries. |
[MS_ATMUni parameters] |
Contains no entries. |
[MS_L2TP parameters] |
Contains entries for the Layer 2 Tunneling Protocol (L2TP). |
[MS_MSClient parameters] |
Contains entries for Client for Microsoft Networks. |
[MS_NetMon parameters] |
Contains no entries. |
[MS_NWClient parameters] |
Contains entries for Client Service for NetWare. |
[MS_NWIPX parameters] |
Contains entries for the Internetwork Packet Exchange (IPX) protocol. Its parameters are network adapter–independent. |
[MS_NwSapAgent parameters] |
Contains no entries. |
[MS_PPTP parameters] |
Contains entries for the Point-to-Point Tunneling Protocol (PPTP). |
[MS_Psched parameters] |
Contains no entries. |
[MS_RAS parameters] |
Contains entries for the Routing and Remote Access service. |
[MS_RasSrv parameters] |
Contains entries for the Routing and Remote Access service for remote access servers. |
[MS_Server parameters] |
Contains entries for the File and Print Service. |
[MS_TCPIP parameters] |
Contains entries for configuring the TCP/IP protocol. |
[MS_WLBS parameters] |
Contains parameters for configuring Network Load Balancing (formerly, Windows Load Balancing Service, or WLBS) and binding Network Load Balancing to multiple network adapters. |
[NetAdapters] |
Contains entries that specify network adapters. |
[NetBindings] |
Contains entries for disabling, enabling, and demoting binding rules for network components such as services, protocols, and adapters. |
[NetClients] |
Contains an entry for specifying the network clients to install. |
[NetOptionalComponents] |
Contains entries for installing optional network components. |
[NetProtocols] |
Contains an entry for installing the network protocols. |
[NetServices] |
Contains entries for installing network services. |
[Networking] |
Contains no entries. However, to configure network protocols, you must include the [Networking] section name in your answer file. |
[params.adapter_instance] |
Contains entries for specifying an adapter’s instance on a computer. |
[protocol_parameters_section] |
Contains an entry for specifying network protocol parameters that are also specified in the [NetProtocols] section. |
[RegionalSettings] |
Contains entries for installing regional options during the setup process. |
[Sysprep] |
Contains an entry for automatically generating the entries in the pre-existing [SysprepMassStorage] section and then installing those mass-storage controllers. |
[SysprepMassStorage] |
Contains entries for identifying the different mass-storage controllers that you want to install on each destination computer. |
[TapiLocation] |
Contains entries for specifying the telephony API (TAPI). It is valid only if a modem is present on the computer. |
[Unattended] |
Contains entries that control the Mini-Setup stage. |
[UserData] |
Contains entries for specifying user settings during the setup process. |
You do not need to add every possible section and entry to the Sysprep.inf file. Most sections and entries are optional, and Mini-Setup ignores optional sections and entries that are not present in the answer file.
If you want to fully automate the Mini-Setup stage, you must configure the following sections and entries in Sysprep.inf. If you do not provide values for these entries in Sysprep.inf, a prompt will appear during the Mini-Setup stage asking for the values.
[GuiUnattended]
You must provide values for the AdminPassword, EncryptedAdminPassword, and TimeZone entries. The value for AdminPassword cannot begin with an asterisk (*). Using a password that begins with an asterisk can cause the password to be set to a null value, which can be a security risk. You must also include the following entries and values: OEMSkipWelcome = 1
and OEMSkipRegional = 1
.
[Identification]
You must specify values for either the JoinWorkgroup entry or the JoinDomain entry. If you choose the latter, you must also provide values for the DomainAdmin and DomainAdminPassword entries. However, if you are concerned about security you might want to leave the DomainAdminPassword blank because this entry cannot be encrypted in the answer file. If you leave the DomainAdminPassword entry blank, you will be prompted for the password during the Mini-Setup stage.
[LicenseFilePrintData]
You must specify values for the AutoMode and AutoUsers entries if you are installing Windows Server 2003. This section does not apply to Windows XP.
[Networking]
At a minimum you must set InstallDefaultComponents=Yes
.
[Unattended]
You must accept the End User License Agreement (EULA) by setting OEMSkipEula = Yes
. You must also provide a value for the InstallFilesPath entry, which specifies the location of any files that are necessary during the Mini-Setup stage, such as language files.
[UserData]
You must specify values for the ComputerName, FullName, and OrgName entries. You must also specify a value for the ProductKey entry.
Winbom.ini Structure
You can use Winbom.ini to automate the Factory-mode stage of an image-based installation with Sysprep. The following table lists all of the valid sections that can appear in a Winbom.ini file.
Answer File Sections for Winbom.ini
Section | Description |
---|---|
[Components] |
Contains entries for installing the components of Windows XP Professional and Windows Server 2003. |
[ComputerSettings] |
Contains entries for configuring user settings on the destination computer. |
[DesktopShortcutsFolder] |
Contains an entry for specifying a shortcuts folder on the desktop. |
[DiskConfig] |
Contains entries for configuring and partitioning one or more physical hard disks when Factory.exe runs in the Windows Preinstallation Environment (Windows PE) |
[description.config] |
Contains entries for configuring partitions located on a physical disk. |
[Factory] |
Contains entries for managing the actions of Factory.exe. |
[NetCards] |
Contains an entry for configuring the network adapter on the destination computer, if Setup requires a network connection. |
[OEMLink] |
Contains entries for adding graphics and text to the Start menu so that users have easy access to an OEM’s customized folder, .htm file, or .exe file for a tour. |
[OEMRun] |
Enables you to run external applications and command-line scripts when auditing the computer in Factory mode, by using the |
[OEMRunOnce] |
Enables you to control how and when external applications and command shell scripts run when auditing the computer in Factory mode, by using the |
[section_name] |
Contains entries for configuring the preinstallation of applications during the Factory-mode stage of Sysprep. This section can be used only with the [OEMRunOnce] section. |
[PnPDrivers] |
Lists all the updated drivers to copy onto the destination computer. |
[PnPDriverUpdate] |
Contains entries for specifying optional user credentials and a source location of drivers to place on an installed image. |
[SetupHomenet] |
Contains an entry for setting up a firewall on a computer with a preconfigured Internet connection. |
[Shell] |
Contains entries for specifying the visual style of the user interface. |
[StartMenuMFUList] |
Contains entries for installing shortcut links in the Start menu. |
[UpdateSystem] |
Contains entries, called directives, for performing registry or file system updates. |
[UserAccounts] |
Contains entries for controlling the creation of user accounts on the destination computer. |
[UserDefined] |
Contains branding information or any other data that other processes might need to access. |
[WinPE] |
Contains entries for identifying the configuration set and Windows operating system that you install. |
[WinPE.Net] |
Contains entries for controlling the settings that Windows Preinstallation Environment (Windows PE) uses to connect to a network. |
You do not need to add every possible section and entry to the Winbom.ini file. All sections and entries are optional, and Factory.exe ignores optional sections and entries that are not present in the answer file.
For more information about answer file sections, including descriptions and examples of entries and values, see “Sysprep Tools and Settings”.
Sysprep Processes and Interactions
Sysprep configures various operating system settings on the master computer to ensure that every copy of the master computer’s disk image is unique when you distribute it to a destination computer. Specifically, Sysprep configures a master installation (and hence, the disk image of that master installation) so that a unique computer security identifier (SID) is generated on each destination computer. A SID is a variable length data structure that identifies a user, a group, or a computer. Internal processes in Windows refer to the SID instead of the computer name or user name or group name. Sysprep resets SIDs by running Setupcl.exe, which is a Sysprep component.
You can also use Sysprep to configure the master computer’s disk image so that every destination computer starts in a special setup mode known as Mini-Setup. Mini-Setup is the first-run experience on Windows Server 2003 and Windows XP, however, you can also configure Sysprep so that Windows Welcome is the first-run experience on Windows XP.
After you copy a disk image onto a destination computer, Mini-Setup runs the first time you start the destination computer. Mini-Setup provides the administrator, technician, or user the opportunity to configure operating system settings that are unique to the user or the computer. For example, computer name, regional options, time zone, and display settings. The Mini-Setup stage is a shortened version of the final stage of an interactive setup.
You can also use Sysprep to configure the master computer’s disk image so that every destination computer starts in a special intermediate setup mode known as Factory mode. Factory mode is controlled by Factory.exe and is commonly used in a manufacturing environment where every computer requires some customization prior to final delivery; however, it is also useful for some corporate deployments. You can use Factory mode if you want to customize individual computers or groups of computers after you have copied a disk image onto a destination computer but before Mini-Setup runs. For example, Factory mode gives you the ability to update drivers, run Plug and Play enumeration, install applications, test hardware and software, and configure computer settings. Factory mode is an extension of Mini-Setup and encompasses many of the same installation and configuration tasks as the final (GUI-mode) stage of an interactive setup.
In addition to preparing a master computer for disk duplication, you can configure Sysprep so that the Mini-Setup and Factory-mode stages are automated. You use an answer file known as Sysprep.inf to automate the Mini-Setup stage of an image-based installation; you use an answer file known as Winbom.ini to automate the Factory-mode stage of an image-based installation. You can also use an answer file known as Cmdlines.txt to automate installation and configuration tasks at the end of the Mini-Setup stage. Cmdlines.txt does not contain any predefined, structured entries like Sysprep.inf and Winbom.ini. Instead, Cmdlines.txt contains command-line instructions similar to a batch file. You can use Cmdlines.txt to perform customized installation and configuration tasks such as installing software programs and running command-line programs.
This section describes the primary processes and interactions that occur when you:
Run the Sysprep tool to prepare a master installation for disk imaging.
Run a destination computer in Factory mode.
Run Mini-Setup to perform final installation and configuration tasks.
Perform post-installation tasks with Cmdlines.txt and the [GuiRunOnce] section.
This section does not discuss all of the processes and interactions that occur during an image-based installation: this section discusses only the processes and interactions that occur when you run the Sysprep tool. For example, the disk-imaging process and the image-copying process are not discussed in this section because these processes vary according to the disk-imaging program that you use.
Tasks Performed by Sysprep
You can use the Sysprep tool to perform four tasks.
Prepare a master installation for final delivery
This is the primary purpose of the Sysprep tool. To do this you run the Sysprep -reseal
command, or click the Reseal button in the Sysprep interface.
Configure a destination computer for Factory mode
This task is performed primarily in manufacturing environments where every computer requires some customization prior to final delivery. However, it is also useful for some corporate deployments. To do this you run the Sysprep -factory
command, or click the Factory button in the Sysprep interface.
Configure a destination computer for auditing
This task is performed to audit a destination computer before Mini-Setup runs. To do this you run the Sysprep -audit
command, or click the Audit button in the Sysprep interface.
Remove hidden mass storage devices
This task is performed to remove references to devices that were present on the master computer but are not present on the destination computer. To do this you run the Sysprep -clean
, Sysprep -factory
, or Sysprep -reseal
command, or click Factory or Reseal in the Sysprep interface.
The following sections describe the processes and interactions that occur when you use the four main parameters of Sysprep. The processes and interactions are presented in the approximate order in which they occur. It is not possible to describe these processes and interactions in precise order because the order might vary slightly depending on the way you perform the image-based installation and the options you choose when you run the Sysprep tool.
Running Sysprep -reseal
There are three types of processes and interactions that occur when you run the Sysprep -reseal
command: verification and data gathering, configuration, and cleanup.
Verification and Data Gathering
Before any configuration settings are changed on the master installation, Sysprep checks various configuration settings and gathers information about the master installation. The main verification and data gathering processes include:
Verifying that no other instance of Sysprep is running on the master installation. If there is another version of Sysprep running, Sysprep generates an error message.
Verifying command-line syntax. For example, several command-line parameters must be used exclusively, such as
-bmsd
,-clean
,-audit
,-factory
, and-reseal
. If these parameters are used with other parameters, Sysprep generates an error.Verifying that the user is a member of the local Administrators group. If not, Sysprep generates an error and exits.
Verifying that the user has sufficient privileges to run Sysprep. Users must have the following privileges: back up files and directories, modify firmware environment variables, restore files and directories, and shut down the system.
Verifying that Setupcl.exe is present in the current directory (usually, systemroot\Sysprep). If the file is present, Sysprep copies it to systemroot\System32. If the file is not present, Sysprep checks for it in systemroot\System32. If it is not present there, Sysprep generates an error message and exits. This process is skipped if you use the
-nosidgen
parameter.Displaying a dialog box that describes the Sysprep tool. Users must verify that they have read this message. This process is skipped if you use the
-quiet
parameter.Verifying that that master computer is not joined to a domain. If it is, Sysprep removes the computer from the domain.
Verifying that the screensaver is not enabled. If it is, Sysprep disables it and saves the settings so it can be enabled and reconfigured during the Mini-Setup stage.
Configuration
After the verification and data gathering processes are complete, Sysprep configures the master installation. The main configuration processes and interactions include:
Checking the operating system version to be sure it is either Windows XP or Windows Server 2003. If you are not running Sysprep on either operating system, Sysprep generates an error and exits.
Finding Sysprep.inf and saving the path information.
Checking whether the master computer is a member of a domain, and if it is, disjoining it from the domain.
Adding the information string to the registry if you specified a value for the OEMDuplicatorString entry in the [GuiUnattended] section of Sysprep.inf.
Configuring the registry so that Setupcl.exe either runs or does not run the first time a destination computer is started. This is depends on whether you use the
-nosidgen
parameter. Setupcl.exe is responsible for resetting SIDs.Removing mass storage devices from the critical device database that were included in the [SysprepMassStorage] section but are not present on the destination computer.
Saving network configuration settings so that they can be reapplied the first time the destination computer is started, and uninstalling all network adapters so that they will be detected the first time a destination computer is started.
Cleanup
After the configuration processes complete, Sysprep cleans up user-specific and computer-specific settings and data that you don’t want copied to a destination computer. The main cleanup processes include:
Deleting Systems Management Server settings.
Deleting the event logs.
Deleting per-user settings, such as user settings for Windows Media Player and Internet Connection Wizard.
Deleting the list of most recently used documents, applications, and Web sites.
Modifying device paths in the registry if you specified a path in the InstallFilesPath entry or the OemPnPDriversPath in the [Unattended] section of Sysprep.inf.
After these processes run, the master computer either shuts down or restarts depending on whether you use the -reboot
or -noreboot
parameters with Sysprep.
Running Sysprep -factory
There are two types of processes and interactions that occur when you run the Sysprep -factory
command: configuration and cleanup.
Configuration
The main configuration processes and interactions that occur when you run the Sysprep -factory
command include:
Renaming Winbom.ini so that the file is not used again in the event that the computer is restarted during the Factory-mode stage.
Checking to see if Factory.exe exists and saving the path information.
Verifying that Factory.exe and Sysprep.exe are on the same drive and in the same location on the drive.
Making various registry modifications so that the destination computer starts in factory mode the first time it is started.
Making sure the user has privileges to update the registry.
Checking whether the master computer is a member of a domain, and if it is, disjoining it from the domain.
Configuring the registry so that Setupcl.exe runs the first time a destination computer is started.
Building the [SysprepMassStorage] section in Sysprep.inf if the BuildMassStorageSection entry is present in the [Sysprep] section of Sysprep.inf or you used the
-bmsd
parameter with Sysprep.Saving network configuraton settings so they can be reapplied the first time the destination computer is started, and uninstalling all network adapters (except legacy network adapters) so they will be detected the first time a destination computer is started.
Cleanup Processes
After the configuration processes complete, Sysprep cleans up user-specific and computer-specific settings and data that you don’t want to appear on a destination computer. The main cleanup processes include:
Deleting per-user settings, such as user settings for Windows Media Player and Internet Connection Wizard.
Deleting the list of most recently used documents, applications, and Web sites.
Modifying device paths in the registry if you specified a path in the InstallFilesPath entry or the OemPnPDriversPath in the [Unattended] section of Sysprep.inf.
Deleting the event logs.
After these processes run, the master computer shuts down.
Running Sysprep -audit
When you use Sysprep to configure a destination computer for auditing, Sysprep changes the registry so that the destination computer starts in an audit mode the next time it is started. When the technician or administrator is finished performing auditing tasks, Sysprep must be run again with the -factory
parameter or the -reseal
parameter, or by clicking Factory or Reseal in the Sysprep interface.
Running Sysprep -clean
When you use Sysprep to remove hidden mass storage devices, Sysprep does two things:
Finds Sysprep.inf and removes the BuildMassStorageSection entry, if it exists.
Removes mass storage devices from the critical device database that were included in the [SysprepMassStorage] section but are not present on the destination computer.
After the command Sysprep -clean
is run, the computer is typically shut down and is ready for delivery to its final destination.
Factory Mode Processes and Interactions
You can use Factory mode to perform configuration and installation tasks on a destination computer. It is most often used to perform configuration and installation tasks that you could not perform on the master installation. This includes such tasks as configuring operating system settings, installing additional device drivers, and installing applications. When you use Factory mode, every destination computer starts in a network-enabled state without starting Mini-Setup. In this state, Factory.exe processes its answer file, Winbom.ini, and performs these actions:
Copies drivers from a network source to the computer.
Starts Plug and Play enumeration.
Stages, installs, and uninstalls applications on the computer from source files located on either the computer or a network source.
Performs configuration tasks specified in the Winbom.ini file.
Locating a Winbom.ini File
Sysprep searches these locations in this order for a Winbom.ini file:
The path and file name specified by the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Factory\Winbom.
The root of all removable media drives that are not CD drives, such as a floppy disk drive.
The root of all CD drives.
The location of Factory.exe, usually the %systemdrive%\Sysprep folder.
The root of %systemdrive%.
After locating a Winbom.ini file, Sysprep reads the value of the WinbomType entry in the [Factory] section. If the value of WinbomType is not appropriate (for example, you use the entry WinbomType = WinPE
but the computer is not running WinPE), the Winbom.ini file is ignored and Sysprep continues searching for a Winbom.ini file. If the value of the WinbomType entry is appropriate, Sysprep reads the value of the NewWinbom entry in the [Factory] section. If a value is specified for NewWinbom, and a Winbom.ini file is located at that location, Sysprep examines that Winbom.ini file for a NewWinbom entry.
This cycle continues until Sysprep locates a Winbom.ini file of the correct type that does not contain a NewWinbom entry or for a maximum of ten times, whichever occurs first. Sysprep then continues to run in Factory mode, performing the tasks that are specified in the Winbom.ini file.
When you run Sysprep in Factory mode, the NewWinbom entry is processed only once at each start.
Processing Winbom.ini
Factory.exe processes Winbom.ini entries in different ways, depending on the value of the WinbomType entry in the [Factory] section of the Winbom.ini file.
If you use the entry
WinbomType = WinPE
, you can start a computer by using the Windows Preinstallation Environment (Windows PE) as the operating system, and run the commandfactory -winpe
to preinstall Windows from a configuration set specified in the Winbom.ini file.If you use the entry
WinbomType = Factory
, the Winbom.ini file can be used to control Sysprep in factory mode, which you run by using the commandSysprep -factory
.If you use the entry
WinbomType = OOBE
, you can use the Winbom.ini file to configure Windows XP during Windows Welcome. After you run the commandSysprep -reseal
, Windows Welcome runs the next time you start the computer.
A state is the smallest group of Winbom.ini sections and entries that is logged as a single unit. For each value of the WinbomType entry, the states are listed in the order in which Factory.exe processes them. States always restart the computer, meaning that if the computer restarts either programmatically or unexpectedly, Factory.exe resumes by processing its last state, along with any states that are processed on every restart of the computer for that value of WinbomType.
Specific states can apply to more than one value of the WinbomType entry, and Factory.exe might process the same state multiple times during a particular instance of running the tool.
The following sections contain information about the states that occur during each type of Winbom.ini processing. The information for each state is listed in a table formatted as follows:
State |
Name of the state as it appears in the user interface and/or the log file. This name is localized and can be different in each language build of Factory.exe. |
Winbom.ini |
List of the Winbom.ini sections and entries processed in this state.
|
Default |
Specifies the default value if the entry is omitted or blank.
|
Executes |
Specifies if this state is processed once or on every boot of the computer.
|
Variables |
Specifies if the entries processed in this state support environment variables.
If the state occurs before a user account logs on to the system or during Windows Welcome, then that state supports only system environment variables, not per user-defined environment variables, because the state is processed in the system context. |
Comments |
Additional comments, if any. |
Winbom.ini Processing When Preinstalling Windows from Windows PE
The states in this section contain the Winbom.ini entries that are processed when you start a computer by using Windows PE as the operating system, and run the command factory -winpe
to preinstall Windows from a configuration set specified in the Winbom.ini file. WinbomType, located in the [Factory] section of the Winbom.ini file, must include the value WinPE.
The following tables describe the states in the order in which they are processed.
State |
Setting display resolution |
Winbom.ini |
[ComputerSettings] DisplayResolution DisplayRefresh |
Default |
[ComputerSettings] DisplayResolution = "800x600x16" |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Partitioning disks and formatting drives |
Winbom.ini |
[DiskConfig] DiskN [description.Config] WipeDisk ForceFormat FileSystemN PartitionTypeN QuickFormatN SetActiveN SizeN N is the (1-based) index of the physical disk. |
Default |
On 32-bit versions of Windows:
On 64-bit versions of Windows:
|
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Creating Page File |
Winbom.ini |
[WinPE] PageFileSize |
Default |
If the computer has less than 64 MB of physical memory:
|
Executes |
Always |
Variables |
No |
Comments |
If the machine has more than 64 MB of physical memory, the page file size is 0 by default. |
State |
Starting Networking |
Winbom.ini |
[WinPE.Net] Startnet IPConfig SubnetMask Gateway |
Default |
[WinPE.Net] Startnet = Yes IPConfig = DHCP |
Executes |
Always |
Variables |
No |
Comments |
If StartNet = No, then subsequent values are ignored. If IPConfig = DHCP, then SubnetMask and Gateway are ignored. |
State |
Installing applications |
Winbom.ini |
[OEMRunOnce] |
Default |
Nothing |
Executes |
Always |
Variables |
No |
Comments |
Credentials come from the UserName and Password entries in the [Factory] section. |
State |
Launching [OEMRun] programs |
Winbom.ini |
[OEMRun] |
Default |
None |
Executes |
Always |
Variables |
No |
Comments |
Credentials come from the UserName and Password entries in the [Factory] section. |
State |
Installing the Configuration Set |
Winbom.ini |
[WinPE] ConfigSet Lang Quiet SKU SourceRoot |
Default |
[WinPE] Quiet = No |
Executes |
Always |
Variables |
No |
Comments |
Credentials come from [WinPE] section or from the UserName and Password entries in the [Factory] section. |
State |
Processing INF settings |
Winbom.ini |
[UpdateSystem] |
Default |
None |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Finishing Windows PE |
Winbom.ini |
[WinPE] Restart |
Default |
[WinPE] Restart = Prompt |
Executes |
Always |
Variables |
No |
Comments |
None |
Winbom.ini Processing During Sysprep in Factory Mode
The states in this section are the Winbom.ini entries processed when you run the command Sysprep -factory
. The WinbomType entry, located in the [Factory] section of the Winbom.ini file, must include the value Factory.
The following tables describe the states in the order in which they are processed.
Note
- The
Sysprep -factory
command starts very early in the operating system boot sequence to enable operations that must occur before other system processes start. For example, during Plug and Play device enumeration, other system services and boot processes run, theSysprep -factory
command performs other tasks with the full Windows operating system running in the background.
State |
Extending system drive |
Winbom.ini |
[ComputerSettings] ExtendPartition |
Default |
[ComputerSettings] ExtendPartition = 0 |
Executes |
Once |
Variables |
No |
Comments |
You can extend only NTFS file system partitions. The partition to extend must have unpartitioned space available on its disk following the partition. |
State |
Setting source path |
Winbom.ini |
[ComputerSettings] SourcePath |
Default |
Nothing |
Executes |
Once |
Variables |
Yes |
Comments |
This should point to the folder that contains the I386 folder. If the files exist in the root, and this entry is present, and the source path that it points to does not exist, Factory.exe moves the files from the root to where the source path points. |
State |
Installing test certificate |
Winbom.ini |
[ComputerSettings] TestCert |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Setting factory computer name |
Winbom.ini |
[Factory] FactoryComputerName RebootAfterComputerName |
Default |
[Factory] RebootAfterComputerName = No |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Copying updated drivers |
Winbom.ini |
[PNPDrivers] [PNPDriverUpdate] DevicePath TargetRoot |
Default |
[PNPDrivers] [PNPDriverUpdate] TargetRoot = %SYSTEMROOT%\drivers |
Executes |
Once |
Variables |
Yes |
Comments |
None |
State |
Starting Plug and Play |
Winbom.ini |
Nothing |
Default |
Nothing |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Setting display resolution |
Winbom.ini |
[ComputerSettings] DisplayResolution DisplayRefresh |
Default |
[ComputerSettings] DisplayResolution = "800x600x16" |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Customizing shell settings |
Winbom.ini |
[Shell] MSNExplorer DefaultStartPanelOff DefaultThemesOff CustomDefaultThemeFile DoDesktopCleanup |
Default |
Nothing |
Executes |
Once |
Variables |
CustomDefaultThemeFile |
Comments |
DefaultStartPanelOff, DefaultThemesOff, and CustomDefaultThemeFile change the relevant setting only when new users are created. These settings are not changed on the administrator/owner account. |
State |
Preparing for automatic logon |
Winbom.ini |
[ComputerSettings] AuditAdminAutoLogon |
Default |
[ComputerSettings] AuditAdminAutoLogon = No |
Executes |
Once |
Variables |
No |
Comments |
If AuditAdminAutoLogon = Yes, then Factory.exe logs on to the desktop by using the administrator account. On Windows XP Home Edition, the owner account is used instead of the administrator account. |
State |
Waiting for Plug and Play to finish |
Winbom.ini |
[PNPDriverUpdate] WaitForPnP |
Default |
[PNPDriverUpdate] WaitForPnP = Yes |
Executes |
Always |
Variables |
No |
Comments |
Runs only if WaitForPnP = Yes. |
State |
Updating installed drivers |
Winbom.ini |
[PnPDriverUpdate] UpdateInstalledDrivers |
Default |
If the first-run experience is Windows Welcome:
If the first-run experience is Mini-Setup:
|
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Setting display resolution |
Winbom.ini |
[ComputerSettings] DisplayResolution DisplayRefresh |
Default |
[ComputerSettings] DisplayResolution = "800x600x16" |
Executes |
Always |
Variables |
No |
Comments |
This state is run a second time, in case Plug and Play installed a new display driver. |
State |
Optimizing Shell |
Winbom.ini |
[Factory] OptimizeShell |
Default |
[Factory] OptimizeShell = Yes |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Customizing shell font settings |
Winbom.ini |
[ComputerSettings] FontSmoothing |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Customizing shell settings |
Winbom.ini |
[Shell] DefaultStartPanelOff DefaultThemesOff CustomDefaultThemeFile |
Default |
Nothing |
Executes |
Once |
Variables |
CustomDefaultThemeFile |
Comments |
DefaultStartPanelOff, DefaultThemesOff, and CustomDefaultThemeFile change the relevant setting only when new users are created. These settings are not changed on the administrator/owner account. |
State |
Customizing power settings |
Winbom.ini |
[ComputerSettings] Hibernation PowerScheme |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Customizing home network settings |
Winbom.ini |
[SetupHomeNet] EnableFirewall |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
If this section exists, Factory.exe uses the Home Networking feature to configure settings. |
State |
Adding user identities |
Winbom.ini |
[UserAccounts] |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
User accounts are not configured on the Windows Server 2003 family. |
State |
Processing INF settings |
Winbom.ini |
[UpdateSystem] |
Default |
Nothing |
Executes |
Always |
Variables |
No |
Comments |
None |
State |
Configuring Optional Components |
Winbom.ini |
[Components] |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Installing applications |
Winbom.ini |
[OEMRunOnce] |
Default |
Nothing |
Executes |
Always |
Variables |
Yes |
Comments |
Credentials come from the UserName and Password entries in the [Factory] section. |
State |
Adding Start Menu frequently used links |
Winbom.ini |
[StartMenuMFUlist] |
Default |
Nothing |
Executes |
Once |
Variables |
Yes |
Comments |
None |
State |
Recording OEM application preferences |
Winbom.ini |
[Shell] DefaultClientStartMenuInternet DefaultClientMail DefaultClientMedia DefaultClientIM DefaultClientJavaVM |
Default |
Nothing |
Executes |
Once |
Variables |
Yes |
Comments |
None |
State |
Applying OEM Start Menu branding |
Winbom.ini |
[OEMLink] [DesktopShortcutsFolder] |
Default |
Nothing |
Executes |
Once |
Variables |
Yes |
Comments |
None |
State |
Launching [OEMRun] programs |
Winbom.ini |
[OEMRun] |
Default |
Nothing |
Executes |
Always |
Variables |
Yes |
Comments |
Credentials come from the UserName and Password entries in the [Factory] section |
State |
Waiting for Plug and Play to Finish |
Winbom.ini |
[PnPDriverUpdate] WaitForPnP |
Default |
[PNPDriverUpdate] WaitForPnP = Yes |
Executes |
Always |
Variables |
No |
Comments |
Runs only if WaitForPnP = Yes. |
State |
Launching Sysprep |
Winbom.ini |
[Factory] Reseal ResealFlags ResealMode |
Default |
On Windows XP Home Edition or Windows XP Professional:
On Windows XP 64-Bit Edition or the Windows Server 2003 family:
|
Executes |
Always |
Variables |
No |
Comments |
On Windows XP 64-Bit Edition or the Windows Server 2003 family, the default behavior is for Sysprep to run and present its user interface. |
Winbom.ini Processing During Windows Welcome
The states in this section are the Winbom.ini entries processed at the beginning of Windows Welcome on Windows XP. These states are not processed if the first-run experience is Mini-Setup. The WinbomType entry, located in the [Factory] section of the Winbom.ini file, must include the value OOBE.
The following tables describe the states in the order in which they are processed.
State |
Extending system drive |
Winbom.ini |
[ComputerSettings] ExtendPartition |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Setting source path |
Winbom.ini |
[ComputerSettings] SourcePath |
Default |
Nothing |
Executes |
Once |
Variables |
Yes |
Comments |
The value of SourcePath the folder that contains the I386 folder. If the files exist in the root, this entry is present, and the source path that it points to does not exist, then Factory.exe moves the files from the root to the location specified by SourcePath. |
State |
Installing test certificate |
Winbom.ini |
[ComputerSettings] TestCert |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Updating installed drivers |
Winbom.ini |
[PnPDriverUpdate] UpdateInstalledDrivers |
Default |
[PNPDriverUpdate] UpdateInstalledDrivers = Yes |
Executes |
Once |
Variables |
No |
Comments |
Only functions if UpdateInstalledDrivers = Yes. |
State |
Setting display resolution |
Winbom.ini |
[ComputerSettings] DisplayResolution DisplayRefresh |
Default |
[ComputerSettings] DisplayResolution = "800x600x16" |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Optimizing Shell |
Winbom.ini |
[Factory] OptimizeShell |
Default |
[Factory] OptimizeShell = Yes |
Executes |
Always |
Variables |
No |
Comments |
Does not function if OptimizeShell = No. If OptimizeShell = Yes, the Windows shell settings are configured every time Windows Welcome runs, even if that causes the computer to restart. |
State |
Customizing shell settings |
Winbom.ini |
[Shell] MSNExplorer DefaultStartPanelOff DefaultThemesOff CustomDefaultThemeFile DoDesktopCleanup |
Default |
Nothing |
Executes |
Once |
Variables |
CustomDefaultThemeFile |
Comments |
DefaultStartPanelOff, DefaultThemesOff, and CustomDefaultThemeFile change the relevant setting only when new users are created. These settings are not changed on the administrator/owner account. |
State |
Customizing power settings |
Winbom.ini |
[ComputerSettings] Hibernation PowerScheme |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
State |
Configuring Optional Components |
Winbom.ini |
[Components] |
Default |
Nothing |
Executes |
Once |
Variables |
No |
Comments |
None |
Mini-Setup Processes and Interactions
Mini-Setup is a shortened version of an interactive setup. Syssetup.dll controls Mini-Setup, which is the same DLL that controls the final stage (GUI mode stage) of an interactive setup. However, not all of the interactive setup steps are performed during Mini-Setup because the operating system was already installed when the master installation was created.
The primary processes and interactions that occur during the Mini-Setup stage are described below in the approximate order in which they occur.
Search for a Sysprep.inf file. If a Sysprep.inf is found, read it and save the settings.
Begin Plug and Play enumeration and installation of devices.
Determine whether any network components need to be reconfigured because the SIDs changed, and perform the necessary configuration tasks.
Extend the primary partition, if specified in the answer file.
Start the Mini-Setup wizard, which displays the following dialog boxes (if Sysprep.inf contains the configuration information required for a dialog box, the box is not displayed or it is displayed briefly and then closed).
Welcome to the Windows Setup Wizard (click Next)
End-User License Agreement (accept or not accept)
Regional and Language Options
Personalize Your Software (user name and organization name)
Your Product Key
Licensing Modes (per server or per device or per user)
Computer Name and Administrator Password
Date and Time Settings
Networking Settings (typical or custom)
Workgroup or Computer Domain
Completing the Windows Setup Wizard (click Finish)
Execute the commands in Cmdlines.txt.
Write any commands listed in the [GUIRunOnce] section to the registry so they can run the first time the computer starts and a user logs on.
Update the HAL, if specified in the answer file.
Delete the Sysprep folder, which is in the systemroot root.
When the Mini-Setup stage finishes, the computer restarts and the entries specified in the [GUIRunOnce] section are run.
Post Installation Processes and Interactions
Several Sysprep installation processes occur after an operating system is installed on a destination computer. These processes occur when you automate post-installation configuration tasks. Examples of post-installation configuration tasks include running command-line programs to configure system services, running scripts to configure Group Policy settings, and installing software programs. The most commonly used mechanisms for automating post-installation tasks is the Cmdlines.txt file and the [GUIRunOnce] in the Sysprep.inf answer file.
Cmdlines.txt Processes and Interactions
A Cmdlines.txt file contains a list of commands, programs, scripts, or batch files that run just after the Mini-Setup stage finishes but before the destination computer restarts. By default, Cmdlines.txt does not exist, so you must manually create the file with a text editor, such as Notepad.
The syntax for Cmdlines.txt is as follows:
[Commands]
"command_1"
"command_2"
.
.
"command_x"
Where command_1, command_2, and command_x refer to the commands, programs, scripts, or batch files that you want to run when the Mini-Setup stage is complete. Note that all commands must be enclosed in quotation marks. Also, if you are using the command window (Cmd.exe) to run commands, programs, scripts, or batch files, then you need to use the /c
parameter with the cmd
command.
For example, to create a new folder named Test on drive C, you type:
"cmd /c mkdir c:\Test"
In addition, to use a Cmdlines.txt file, you need to:
Add the following section, entry, and value to your Sysprep.inf answer file:
[Unattended] InstallFilesPath = C:\Sysprep\i386
In the distribution share that you used to create the master installation, create the following folder: systemdrive\Sysprep\i386\$OEM$.
Copy Cmdlines.txt to the systemdrive\Sysprep\i386\$OEM$ folder.
You can only have one Cmdlines.txt file, but you can use it to run multiple commands, programs, scripts, or batch files. When these commands, programs, scripts, or batch files run, the following processes and interactions occur:
The commands, programs, scripts, and batch files run synchronously, which means each command, program, script, or batch file runs to completion before the next one starts running.
All commands, programs, scripts, and batch files specified in a Cmdlines.txt run under the Local System security account.
Network connectivity is not available when the commands, programs, scripts, and batch files listed in a Cmdlines.txt file run.
Windows Installer packages (.msi files) cannot be run from a Cmdlines.txt file.
[GuiRunOnce] Processes and Interactions
The [GuiRunOnce] section of an answer file contains a list of commands, programs, scripts, or batch files that run the first time an administrator or technician logs on to the destination computer after the operating system is installed.
The syntax for [GuiRunOnce] is:
[GuiRunOnce]
"command_1"
"command_2"
.
.
"command_x"
Where command_1, command_2, and command_x refer to the commands, programs, scripts, or batch files that you want to run after the operating system is installed and the administrator or technician logs on. Note that all commands must be enclosed in quotation marks.
The commands that are listed in the [GuiRunOnce] section are stored in the following registry location:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce
When an administrator or technician logs onto the destination computer for the first time after the Mini-Setup stage is complete, Windows Server 2003 reads and then runs the commands that are listed in this registry location. When these commands, programs, scripts, or batch files run, the following processes and interactions occur:
The commands, programs, scripts, and batch files run synchronously, which means each command, program, script, or batch file runs to completion before the next one starts running.
The commands, programs, scripts, and batch files listed in the [GuiRunOnce] section run under the security account of the user who logged onto the destination computer (usually an administrator or a technician).
Network connectivity is available when the commands, programs, scripts, and batch files run.
You can use Windows Installer packages (.msi files) to install applications (unlike Cmdlines.txt).
You can run commands, programs, scripts, and batch files from hard disk drives, CD drives, shared folders on the network, or other storage devices (unlike Cmdlines.txt, which runs everything from the $OEM$ folder in your distribution share).
In addition, there are some interactions and processes that you might need to control if you run certain commands, programs, scripts, and batch files with the [GuiRunOnce] section.
Prevent restarts
You can run commands, programs, scripts, and batch files only if you can prevent the command, program, script, or batch file from restarting the computer. When a computer restarts, all remaining entries in the [GuiRunOnce] section are lost because the Runonce registry entry is deleted. If the system restarts before completing entries listed in the [GuiRunOnce] section, the remaining items will not run. Therefore, you need to suppress restarts. If you cannot suppress a restart within a command, program, script, or batch file, you can try to repackage the command, program, script, or batch file into a Windows Installer package.
Do not rely on the Windows Explorer shell
The Windows Explorer shell is not loaded when the operating system starts running commands, programs, scripts, or batch files that are listed in the [GuiRunOnce] section of an answer file. In some cases, you can get an updated installer program from the application vendor that does not rely on the Windows Explorer shell. If you cannot, you might be able to repackage the command, program, script, or batch file as a Windows Installer package (.msi file).
Control the processes by using the /wait parameter
Commands, programs, scripts, and batch files often start and stop several different processes. In some cases, when you are running multiple programs — especially installation programs — this can inadvertently cause the next program listed in the [GuiRunOnce] section to start before the previous program is finished running. When this occurs, the second program usually fails. To prevent this, you can run the programs from batch files by using the start
command with the /wait
parameter. This forces each program to complete before the next command listed in [GuiRunOnce] runs.
Related Information
The following resources contain additional information that is relevant to this section.