Customizing Your Sysprep.inf For Use (Last updated 5/15/08 )
-Understanding the sysprep.inf
I am know there are other sections to the sysprep.inf then what I will use in this example but in my environment I only use these so I will stick to these. Many of these are also optional and many don’t seem to have an effect in my environment but I will still explain them to you. You can find more resources on the sysprep.inf parameters on the Microsoft KB article 298491 and on Microsoft’s Windows 2000 Deployment Guide.
I would suggest running setupmgr.exe in the sysprep folder to create a base sysprep.inf file and to then edit it by hand from then on as setupmgr.exe can delete some of your customizations.
- Our sample sysprep.inf
;SetupMgrTag
; ----------------- Sysprep Notes -----------------
; Note: All notes in this files must have a ';' before them, and the first line should not be changed from ';SetupMgrTag'
;
; Steps to using this file:
; 1: Run the file c:\sysprep\utils\PNPPath.bat - this will set the OemPnPDriversPath below for syspreps use
; 2: Verify if you need a new HAL and add appropriate UpdateUPHAL or UpdateHAL lines below under the [unattended] section
; 3: Verify the admin password in the [GuiUnattended] section
; If done properly this file is deleted after sysprep completes so this should not be a security issue
;
[Unattended]
OemPnPDriversPath="Drivers\1\1;Drivers\1\10;Drivers\1\11;Drivers\1\12;Drivers\1\13;Drivers\intel"
DriverSigningPolicy=Ignore
InstallFilesPath=C:\sysprep\i386
TargetPath=\WINDOWS
KeepPageFile=0
OemSkipEULA=Yes
UpdateInstalledDrivers=Yes
NonDriverSigningPolicy=Ignore
UpdateServerProfileDirectory=1
[Sysprep]
BuildMassStorageSection=Yes
[GuiUnattended]
AdminPassword="0h S0 S3cure"
EncryptedAdminPassword=NO
OEMSkipRegional=1
OEMDuplicatorstring="Demo Clone"
TimeZone=10
OemSkipWelcome=1
AutoLogon=Yes
AutoLogonCount=3
[FavoritesEx]
Title1="Google.com"
URL1="http://google.com"
[UserData]
FullName="Your Name"
OrgName="Your Orginization"
ComputerName=*
ProductKey=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
[Display]
BitsPerPel=32
Xresolution=1024
YResolution=768
Vrefresh=72
AutoConfirm=1
[TapiLocation]
CountryCode=1
Dialing=Tone
AreaCode=719
LongDistanceAccess="9"
[RegionalSettings]
LanguageGroup=13,17,3,2,5,16,4,12,15,7,8,10,11,9,6,14,1
Language=00000409
[Networking]
InstallDefaultComponents=Yes
[Identification]
JoinWorkgroup=TEMPORARY
[GuiRunOnce]
Command0=c:\drivers\scripts\cleanup.bat
[SysprepMassStorage]
*pnp0a00=c:\windows\inf\machine.inf
*pnp0a01=c:\windows\inf\machine.inf
*pnp0a04=c:\windows\inf\machine.inf
*pnp0a03=c:\windows\inf\machine.inf
pci\cc_0604=c:\windows\inf\machine.inf
pci\cc_0601=c:\windows\inf\machine.inf
...Shortand for this post...
pci\ven_1055&dev_9130=c:\windows\inf\mshdc.inf
pcmcia\micron-mtcf____-392d=c:\windows\inf\mshdc.inf
pci\ven_1179&dev_0105=c:\windows\inf\mshdc.inf
-Section by Section
[Unattended]
OemPnPDriversPath=… We talked about this in Part 1 of this series
DrvierSigningPolicy=Ignore This will let SysPrep silently install drivers that are not signed
InstallFilesPath=c:\sysprep\i386 This should be the location of the i386 folder from the Windows XP CD
TargetPath=\Windows The folder name to install windows to
KeepPageFile=0 Deletes the page file to help make sure no residual from the other hardware is still hanging around
OEMSkipEULA=Yes Accepts the EULA for you automatically
UpdateInstalledDrviers=Yes Reinstalls any drivers that have updates to them
NonDriversSigningPolicy=Ignore Ignores warnings about unsigned files that are not drivers
UpdateServerProfileDirectory=1 More Info The article talks about this setting with a hotfix and SP2, but in this hotfix seems to be included in SP3. This setting takes the administrator profile and copies it to the default profile.[Sysprep]
BuildMassStorageSection=Yes Extremely important as this will build all mass storage drivers[GuiUnattended]
AdminPassword=… Set this to your password
EncrypedAdminPassword=NO I always opt out of encrypting the admin password as I have had times this step fails and encrypting the password disables the autologon feature use further down
OEMSkipRegional=1 Skips the Regional options page
OEMDuplicatorString=”Clones Name” This is a key put into the registry so you can track what clone a computer came from
TimeZone=10 10 just happens to MST so you will need to change this to your time zone
OEMSkipWelcome=1 Skips the Welcome Screen
AutoLogon=Yes Logs the administrator into the computer automatically after sysprep finishes
AutoLogonCount=3 Will log the administrator on for 3 reboots. Note that if you log off the PC it will log you right back on until you restart[FavoritesEX]
Title1=”Google.com” This is to add a favorite to IE automatically but it has yet to work for me. Change the number for each new site
URL1=http://google.com The URL to match Title1[UserData]
FullName=”Your Name” The name in which the computer is registered to
OrgName=”Your OrgName” The organization in which the computer is registered to
ComputerName=* Let sysprep pick a random computer name
ProductKey= Put your volume license key in here, if you do not have one leave this value blank. Look for another post from me shortly to get around typing in the key on every computer if you don’t have a VLK[Display]
BitsPerPel=32 32bit color
xResolution=1024 set the monitor to 1024×768
yResolution=764 set the monitor to 1024×768
vRefresh=72 72 Hz
AutoConfirm=1 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[TapiLocation]
CountryCode=1 1 is for the US, change this accordingly
Dialing=Tone Set the modem to tone dialing
AreaCode=719 Your area code
LongDistanceAccess=”9″ Set this to the number the computer will need to use to get an outside line[RegionalSettings]
LanguageGroup=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 Installs all languages
Language=00000409 set the default to English[Networking]
InstallDefaultComponents=Yes Installs all the default network protocols[Identification]
JoinWorkgroup=Temp Joins the computer to a workgroup called Temp[GuiRunOnce]
Command0=c:\drivers\scripts\cleanup.bat Runs a program once the computer boots into windows. I will explain cleanup.bat in a little[SysprepMassStorage]
This section is created automatically and contains a list of mass storage drivers.
- Creating the Mass Storage Devices List
SysPrep will need to know what type hard drive drivers to load during setup so you should always create you [SysprepMassStorage] section to help it out will all your drivers. The get this section filled in with all your values run sysprep.exe with the -bmsd switch.
- Creating Cleanup.bat
If you were paying attention to my sample sysprep.inf file you noticed a cleanup.bat file that would be run on login once the computer was finished syspreping. This is optional but I always delete the drivers folder off the root of the hard drive. To accomplish this with ease download movefile.exe from Microsoft and place it in a ’scripts’ folder within the drivers folder along with a new batch file called cleanup.bat
Edit this cleanup.bat file and add the following to it:
@echo off
cls
title PCHS Clone Process - Cleaning Files
echo.
echo Cleaning unneeded drivers from sysprep process.
cd /d c:
cd \
"c:\drivers\scripts\movefile.exe" c:\drivers\ "" 1>nul 2>nul
rmdir /s /q c:\drivers\ 2>Nul
del /s /q /f c:\drivers\ 2>nul
This will start a little command window on login that will delete as many drivers as it can and then proceed to delete any it couldn’t delete on the next restart. The plug and play section of SysPrep should have installed all the drivers you need from this folder so there is very little use for this folder now.
Sorry this isn’t easy to read but I don’t want to spend to much time touching it up.





January 21, 2008 at 8:11 am
If you are trying to include SCSI or SATA drivers, it is better to run sysprep -bmsd rather than use the BuildMassStorageSection=Yes line. Both methods build the generic mass storage controller entries, but the SysprepMassStorage section entries for any custom SCSI or SATA drivers that you add *must* be present before you run sysprep or the driver information will not be included and your drivers will never load (BSOD 7B). It’s not something you can do on the fly in one step.
January 23, 2008 at 2:15 pm
Looking through all my documentation I can’t figure out how I missed this. All my batch and inf files don’t use the -bmsd switch but you are right. I am guessing since we don’t build on and SCSI or SATA devices I never scripted this.
Glenn has a great point, the BuildMassStorageSection=Yes is not nearly as important as the -bmsd switch.
Thanks Glenn, glad to see what I have is semi useful to others and yet still has room to grow.
January 24, 2008 at 2:56 pm
[...] As always I found more info to add on to a previous post… To find the original post with much more info then this post please look at this post: SysPrep Part 5 [...]
January 30, 2008 at 10:31 am
In the section
[GuiUnattended]
AdminPassword=… Set this to your password
Only use this if the password for the admin account is already blank. Otherwise it will fail to change it or set it. I learned this lesson after examining my logs files after running sysprep. I just set it on the initial install of WinXP, then leave it out of the sysprep.inf file.
The log files for WinXP sysprep/setup are:
setuplog.txt – Contains information about setup actions during the installation.
setuperr.txt – Contains information about setup errors during the installation.
setupapi.log – Contains information about hardware detection during the installation
Those log explanations are from the BDD 2007 WinXP FAQ: http://blogs.technet.com/msdeployment/archive/2007/09/11/bdd-2007-faq-windows-xp-deployment.aspx
Kepp up the good work on your sysprep series, I’m sure plenty of people will find it useful.
January 30, 2008 at 1:09 pm
Interesting, I don’t think I have ever noticed this but I might have disregarded it if I did run into it.
Thanks for adding the info on the log files, it’s always nice to know where to look for errors when something does go wrong.
Thanks Rob for the kind words and extra info.
January 30, 2008 at 4:37 pm
One more thing I learned today about sysprep and the DriverSigningPolicy=Ignore entry, if you run mini-setup, it won’t load the driver until you log in the first time. DriverSigningPolicy=Ignore only works with the -PNP switch, which makes mini-setup take longer. For those of us supporting Dell GX270s for example, the latest 865G video driver is unsigned. So either use an older signed driver, or sysprep -pnp, or load the driver interactively at first boot. Great, just great!
It’s covered here: http://support.microsoft.com/kb/256204
January 30, 2008 at 4:53 pm
How wonderful…
Yet again, thanks for the great input!
February 2, 2008 at 5:58 am
Awesome!
February 5, 2008 at 3:05 pm
For those of you that use the MachineObjectOU under the Identification section, if the computer account is already present in the domain (if you re-image an existing system) this line will be ignored in favor of where the account already resides. Not sure, but I believe sysprep lacks the functionality to move an AD object but does pass this as amplifying info when it joins a domain and would be creating the initial AD object. Drove me nuts for a while.
February 5, 2008 at 3:18 pm
Opps, hadn’t read the addendum you posted. MachineObjectOU was already covered. Sorry about that.
April 16, 2008 at 11:02 am
Looking back it seems I might have posted about some legacy functions of sysprep.inf. I believe that FavoritesEX is no longer used and can be omitted, can anyone confirm this?
April 18, 2008 at 9:23 am
David,
Great site, I have been referring to it often as I typically make most of the recovery images for our company. I did notice, however, that you have KeepPageFile=0 and according to Microsoft 0 will regenerate the page file and 1 will not regenerate it. I will be testing it today =)
May 15, 2008 at 7:58 am
[...] have been changes to sysprep in XP SP3. I have updated my pages to reflect this but the issue deals with the default profile and it no longer being copied when [...]
May 23, 2008 at 8:03 am
I would like to echo the applause given by some of the previous people replying to these documents, very good job. I find that taking this info in with info provided in http://www.Vernalex.com has been quite helpful.
My question is with regards to the “ComputerName=*” portion of you INF. I have been using a program called MySysPrep which allows one to name the machine via some info found in the SMBios. Do you know if SysPrep allows me to do the same thing? The entry I use in MySysPrep is “ComputerName=XXXXX-%SerialNo%”.
Oh, check out the MySysPrep page too (just google it); it is very straight forward and a quick read. You may find it useful.
Again thanks for all your hard work!
July 2, 2008 at 11:54 am
[...] have been changes to sysprep in XP SP3. I have updated my pages to reflect this but the issue deals with the default profile and it no longer being copied when [...]
August 11, 2008 at 1:50 pm
[...] have been changes to sysprep in XP SP3. I have updated my pages to reflect this but the issue deals with the default profile and it no longer being copied when [...]
August 26, 2008 at 1:50 am
After having read this it might actually solve some of my problems with Sysprep. One issue still biting me is the display section. Running a primary analog screen extended to a secondary digital screen. After Sysprep have run the extended screen is disabled and need to be manually enabled again. Due to some lockdown functions on our devices that creates more problems than it seems. Can any one assist me with why this happens or how to solve it.
October 17, 2008 at 7:45 am
With building the mass [SysprepMassStorage] section using sysprep -bmsd, how do I tell it to look in my c:\drivers\scsi directory for the inf and driver files? I looked in the inf, and found the ID for the controller I need, but when I looked through the sysprep.inf file, that ID isn’t listed.
October 29, 2008 at 9:15 am
Hi Dylan,
The [SysprepMassStorage] section will only include drivers for devices that are in the computer where -bmsd is run from. If you run sysprep -bmsd on a system without the scsi device it will not include the driver, even if the inf and sys files are in the right places. Try running sysprep -bmsd on a computer with the scsi device installed and then just copy the lines from that sysprep.inf to your master sysprep.inf.
November 7, 2008 at 1:26 pm
hi, I am trying to sysprep a winxp sp3 image from a Dell optiplex GX620, has sata hard drive, integrated audio/video. System I’m cloning the drive to is a Dell Precision 390 which has a scsi/SAS hard drive via pcie card. I am getting a BSOD on bootup with the STOP error 0×7B. Research tells me it has to do with the SAS hard drive. Here’s the thing with sysprep, I’ve copied the I386 folder off a dell winxp sp2 cd into sysprep and am using InstallFilesPath=C:\sysprep\i386 under the [unattended] section. I’ve also tried using the chipset and sas drivers from dell, extracted these with 7-zip and tried to follow your drivers folder setup with OemPnPDriversPath but honestly I am completely confused as to how to set it up, don’t think I did it right. I can’t see why this clone won’t work, especially if I can boot the Precision 390 off the green dell winxp restore cd no problem- that tells me all the drivers are there doesn’t it at least to get the machine to boot and run, and then I see a few devices without drivers in device manager and that’s when I go to the dell chipset & audio & network drivers and everything’s 100%. Any advice on how to get the drive on the gx620 sysprep’d and not get the stop error upon boot on the precision390?
January 14, 2009 at 2:02 pm
Ron, in order for your SAS drive to get detected and load correctly BEFORE sysprep starts [remember that you need to have critical device db entries already included in your image prior to sysprep running, or else sysprep won't be able to access the HDD].
When you run sysprep and reseal your image, make sure that your sysprep.inf includes an entry in your [SysprepMassStorage] section.
For instance here’s an entry from mine for an Adaptec 2-port SATA raid controller:
[SysprepMassStorage]
pci\ven_1095&dev_0240 = c:\sysprep\c\1210sa\win32\aarsi3x.inf, c:\sysprep\c\1210sa\win32\, “Adaptec Embedded Serial ATA HostRAID Driver Windows 2000/XP/2003″, c:\sysprep\c\1210sa\hraidsk1
Make sure that is all one continuous line from pci\…tohraidsk1
this info matches the following syntax:
%FullPlug&playHardwareID% = %pathtodriverfolder%\%drivername%.inf, %pathtodriverfolder%, “%Disk Name% (found in the corresponding INF), %DiskIDFile%
March 3, 2009 at 11:16 am
Nice Info.
One minor issue I’ve run into regards comments in sysprep.inf. According to MS’s syntax rules for INFs ( http://msdn.microsoft.com/en-us/library/ms790225.aspx ):
Any characters following a semicolon on the same line, unless the semicolon appears within a “quoted string” or %strkey% token [have no relevance].
That is a bit strange since the OemPnPDriversPath line is often full of them. I suppose you can put the string with the semicolons in quotes, but I never have and don’t have problems. I have found at least one page with explicit comments (this one is good: http://www.symantec.com/connect/articles/adding-intel-matrix-drivers-your-xp-image-ahci-sata-support ) also.
The problem I ran into is that I can’t seem to have comments at the end of a line. Lines like:
ComputerName=”*” ; creates a random computer name.
and
AdminPassword=”" ; prompt for admin password.
brought up the computer name and admin password prompt with the text fields full of the comment text! Other lines with comments seemed to do wacky things too.
I’m willing to admit that I’m an ignorant fool, but I have NOT been able to find any confirmation that INFs in general can’t have comments at the end of lines OR that sysprep.inf is not-your-usual-kind-of-INF.
Would you please flag me as ignorant or cleaver as the case may be?
Thanks.
March 4, 2009 at 1:50 pm
Erich,
I guess I am ignorant or cleaver as well. I have noticed this same issue with inf’s being malformed but I have never seen issues with it. I haven’t tried doing comments like you mentioned with the ComputerName and AdminPassword keys but it’s interesting to think it does create issues when used in that manner on that key.
Thanks for that great little tidbit, I totally forgot about the ; not being proper formatting.
March 9, 2009 at 8:45 am
Does anyone know of a script (possibly to work with sysprep.inf) that will reassign the original client hostname (NetBIOS name) via resolving the client assigned IP address against DHCP or a WINS server?
Let’s say I have 50 client PCs and I re-image them using a ghostcast server (Note: Using “Configuration Refresh” works but not preferred as who wants to purchase ghost client licenses for over 1,000 PCs) Post imaging generic hostnames were generated via sysprep.inf. I want to retain their previous hostnames that are registered with a WINS server or assigned to IP address in DHCP.
It would be cool to have a script that generated and ran a second sysprep.inf file (post generic hostname assignment) on the client that would input the assigned NetBIOS name from WINS or DHCP based upon client IP address.
Any thoughts?
March 20, 2009 at 11:02 am
[...] http://remyservices.wordpress.com/2007/09/28/sysprep-in-depth-part-5-customizing-sysprepinf/ [...]
April 1, 2009 at 9:12 am
Few observations regarding SCSI/SAS/AHCI HD controllers…
Given:
Source -> image (XP SP3) that was created on IDE or SATA emulation set to IDE machine. (DC7600/7700/7100)
Target -> SATA emulation set to AHCI machine (DC7900)
In my view there is no point running sysprep.exe with -bmsd switch or state BuildMassStorageSection=YES in sysprep. It just makes the whole sysprep procedure longer and doesn’t contribute anything to the result since drivers for for newer HD controllers are not active on source machine and have to be added to the Sysprep.inf manually anyway.
Below is a portion of sysprep.inf that has been proven to make XP SP3 image built on HP DC 7100/7600/7700 work on HP DC7900 (AHCI)
[SysPrep]
BuildMassStorageSection=No
[SysprepMassStorage]
PCI\VEN_8086&DEV_3A02&CC_0106=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_3A22&CC_0106=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_3A55&CC_0106=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_3A56&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_24DF&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_25B0&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2621&CC_0106=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2622&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2652&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2652&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2653&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2681&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2682&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2682&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_27C1&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_27C3&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_27C5&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_27c6&CC_0104=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2821&CC_0106=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_2822&CC_0104=C:\Support\Drivers\dc7900\SATA\iastor.inf
PCI\VEN_8086&DEV_282A&CC_0104=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2829&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2922&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_3A02&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_3A22&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
PCI\VEN_8086&DEV_2929&CC_0106=C:\Support\Drivers\dc7900\SATA\iaahci.inf
I believe only 2 lines from the above (3A02) are really needed for the DC7900, but we left the rest just in case HP in its infinite wisdom decides to switch HD controller in the future.
April 15, 2009 at 4:37 am
[...] Depth – Part 3 – SysPrep.inf and HAL’s SysPrep in Depth – Part 4 – Cleaning Up Unneeded Drivers SysPrep in Depth – Part 5 – Customizing Sysprep.inf SysPrep in Depth – Part 5 addition 1 – Customizing Sysprep.inf SysPrep in Depth – Part 6 – Bringing [...]
June 12, 2009 at 4:10 pm
Also this is good, if anyone didn’t know,
[Unattended]
UpdateUPHAL = “ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf”
Notice that the above command is UpdateUPHAL (UP for Uniprocessor) and that the HAL selected ends in UP. The reason for doing this is when going from Uniprocessor->Multiprocessor, the Multiprocessor HAL will *ALWAYS* be used, regardless of whether the Uniprocessor one is appropriate. Microsoft says there is a “serious” performance hit for using the Multiprocessor HAL on a machine that should use the Uniprocessor HAL – this is why it makes sense to start out with the Multiprocessor HAL base machine (like we do) and check for UP first rather than going the other way.