Sie sind auf Seite 1von 6

Sysprep - Step by Step

Emanuel Shmuelov, 2009

SysPrep is a tool provided by Microsoft; stand for System Preparation – a utility for
Microsoft Windows operating system deployment.
Desktop deployment is typically performed via disk cloning applications. SysPrep can
be used to prepare an operating system for disk cloning and restoration via a disk
image.

Let’s get started…

General preparation
1. Select the oldest PC possible as it is easier to move forward than backwards
2. Prepare the machine with all needed software, updates, configurations etc.
3. Make the following directory C:\sysprep for the Sysprep tools.
4. Via the WinXP installation CD (better is to use the latest SP released by MS)
extract the content of “SUPPORT\TOOLS\Deploy.cab” into it.
5. Via the SysPrep directory run the setupmgr.exe tool; select “Sysprep setup”
option at the “Type of Setup” slide.
An output file is generated and called sysprep.inf with content as described in
Appendix A.
At the end of the setup, click the CANCEL button (dummy bug).
6. Search and delete the drivers cache files as follows:
6.1. Look for “infcache*” files located on the machine. These files contain
cache information regarding already installed drivers.
6.2. Clean the content of the following folders:
%windir%\System32\ReinstallBackups
%windir%\System32\DLLCache
7. Copy i386 directory form the XP installation CD to the c: directory.
Notice: it is better to include the latest XP Service pack to the i386 directory if
possible.
8. Open the sysprep.inf file and update the “[unattended]” section with the
following property: InstallFilesPath=C:\i386
9. Uninstall peripheral hardware drivers:
9.1. The most critic devices to change is the Hard Drive controllers which are
unique to the source machine (you can leave all Standard controllers as-is)
to a Standard type. In order to achieve that follow the following steps:
9.1.1. Double click the unique drive controller
9.1.2. Move to “Driver” tab
9.1.3. Click “Update Driver…”
9.1.4. Manually choose a Standard driver instead from the drivers list
opened at the “Hardware Update Wizard”.
9.2. Uninstall all other peripheral hardware drivers as much as possible via the
“Device Manager” management window.
10. Networking setup
10.1. Disconnect the source PC from any network.
10.2. Disconnect any mapped network drives.
11. Clean PC
11.1. Run cleanmgr.exe
11.2. Remove log files
11.3. Remove Hibernate fie
11.4. Clean any Temp folder
12. Defragment C drive.
13. Add additional drivers to the system – refer Appendix B for more details.

Setting up HAL configuration


The most critic differentiation between PCs is the HAL (hardware abstraction layer)
type. Once you have generated image on a machine with HAL of type X and
extracted the image over machine with HAL of type Y, it is very likely that the OS wil
fail to load with BSOD result.

There are few differences between machine’s HALS:


1. The number of processors supported: UniProcessor HAL vs. MultiProcessor
HAL
2. ACPI and APIC:
2.1. ACPI - Advanced Configuration and Power interface
2.2. APIC - Advanced Programmable Interrupt Controller

Newly machines are most likely to have motherboard supporting APIC and ACPI.

The following UniProcessor HAL values are available to be used in the sysprep.inf
file:
UpdateUPHAL = “ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf”
UpdateUPHAL = “ACPIPIC_UP,%WINDIR%\Inf\Hal.inf”
UpdateUPHAL = “MPS_UP,%WINDIR%\Inf\Hal.inf”

The following MultiProcessor HAL values are available to be used in the


sysprep.inf file:
UpdateHAL = “ACPIAPIC_MP,%WINDIR%\Inf\Hal.inf”
UpdateHAL = “MPS_MP,%WINDIR%\Inf\Hal.inf”
UpdateHAL = “SYSPRO_MP,%WINDIR%\Inf\Hal.inf”

To prevent for the confusion of which HAL to define, prior to making the image use
the HALu.exe utility to change the source machine’s HAL to be the lowest available:
“Standard PC” (which refers to E_ISA_UP).

SysPrep Execution
1. Run sysprep.exe and select the following options via the GUI interface:
1.1. Select “Use Mini-setup”
1.2. Select “Detect non-plug and play hardware” in order to search and
install plug-and-play devices on the destination PC
1.3. Select shutdown mode as “ShutDown”.
2. Press the “Reseal” button and wait until SysPrep finishes its preparation.
3. Once the SysPrep has finished, the machine will shutdown.

Image Preparation
1. Turn ON the machine and load any drive cloning tool (like Symantec Ghost).
2. Make disk image of the source machine.
Deploying to Destination machine
Limitation: In order to deploy the image to the destination machine, the destination’s
disk size should be greater (or equal) to the drive size of the source machine.

1. Extract the image over the destination machine using drive cloning tool (like
Symantec Ghost).
2. After the image was extracted, the machine will load Windows OS, and the
SysPrep will start to install drivers according to the new peripherals found on it,
using the drivers placed under %windir%\drivers directory.
3. Use the HALu.exe utility to change the HAL to the appropriate one.
4. Open the Device Manager window and verify all devices are correctly installed.
Install dedicated device drivers in case standards drivers were installed.

The following logs are generated under the %windir% directory at the destination
machine after the XP is up:
1. setuplog.txt - Contains information about setup actions during the installation.
2. setuperr.txt - Contains information about setup errors during the installation.
3. setupapi.log – Contains information about hardware detection during the
installation
Appendix A – sysprep.inf example
Output of execution of the setupmgr.exe tool is sysprep.inf file, which includes
answers to the unattended installation process which is executed during the loading
of the OS over the new machine.

Below is an example for such output file:

[Unattended]
OemPnPDriversPath="Drivers\1\1;Drivers\1\10;Drivers\1\11;Drivers\1\12;D
rivers\1\13;Drivers\intel"
;This will let SysPrep silently install drivers that are not signed
DriverSigningPolicy=Ignore
;This should be the location of the i386 folder from the Windows XP CD
InstallFilesPath=C:\sysprep\i386
;The folder name to install windows to
TargetPath=\WINDOWS
;Deletes the page file to help make sure no residual from the other hardware is still
hanging around
KeepPageFile=0
OemSkipEULA=Yes
; Reinstalls any drivers that have updates to them
UpdateInstalledDrivers=Yes
; Ignores warnings about unsigned files that are not drivers
NonDriverSigningPolicy=Ignore
;This setting takes the administrator profile and copies it to the default profile
UpdateServerProfileDirectory=1
[Sysprep]
;Extremely important as this will build all mass storage drivers
BuildMassStorageSection=Yes
[GuiUnattended]
AdminPassword="0h S0 S3cure"
EncryptedAdminPassword=NO
OEMSkipRegional=1
;This is a key put into the registry so you can track what clone a computer came
from
OEMDuplicatorstring="Demo Clone"
TimeZone=10
OemSkipWelcome=1
;Logs the administrator into the computer automatically after sysprep finishes
AutoLogon=Yes
AutoLogonCount=3
[FavoritesEx]
;This is to add a favorite to IE automatically but it has yet to work for me. Change
the number for each new site
Title1="Google.com"
;The URL to match Title1
URL1="http://google.com"
[UserData]
FullName="Your Name"
OrgName="Your Orginization"
ComputerName=*
ProductKey=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
[Display]
;32bit color
BitsPerPel=32
Xresolution=1024
YResolution=768
Vrefresh=60
;Confirm the resolution change, if you don’t set this to 1 you will need to click ok
within 15 seconds to keep the video settings once they change
AutoConfirm=1
[TapiLocation]
;1 is for the US, change this accordingly
CountryCode=1
Dialing=Tone
AreaCode=972
;Set this to the number the computer will need to use to get an outside line
LongDistanceAccess="9"
[RegionalSettings]
LanguageGroup=13,17,3,2,5,16,4,12,15,7,8,10,11,9,6,14,1
;set the default to English
Language=00000409
[Networking]
;Installs all the default network protocols
InstallDefaultComponents=Yes
[Identification]
JoinWorkgroup=WORKGROUP
[GuiRunOnce]
;Runs a program once the computer boots into windows
Command0=c:\drivers\scripts\cleanup.bat
[SysprepMassStorage]
;This section is created automatically and contains a list of mass storage drivers
Appendix B – Drivers’ preparation
1. Under “%windir%” create “drivers” directory for additional drivers. Use the
image below for the name convention to use (this is due to the limitation of
bytes allowed to be used in the OemPnPDriversPath section of the sysprep.inf
file):

In each folder create some txt file which translating the numbers to names (i.e. 1
- network cards, 11 - intel net driver, 12 - Linksys net driver etc.)

2. There are two options to tell Sysprep where to look for additional drivers:
2.1. Update the “[unattended]” section with the following property:
OemPnPDriversPath="%windir%\Drivers\1\1;%windir%\Drivers\1\10;
%windir%\Drivers\9\4;%windir%\Drivers\9\5;
%windir%\Drivers\9\6;%windir%\Drivers\intel"
Tip: You could find “PNPPath.vbs” utility useful for automating the process
of creating the path list.
2.2. Update the “DevicePath” registry key located under the following path:
’HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion’
Tip: You could find “spdrvscn.exe” utility useful for automating the
process of creating the path list.
Notice: each time you update the drivers’ content, you need to update the path
list.
3. Enable READ permission to all files located under the drivers path using
command line:
cacls “%windir%\drivers” /e /p "everyone":r
cacls “c:\sysprep” /e /p "everyone":r