SPREAD THE WORD, TOGETHER WE HAVE CONQUERED SYSPREP
This is version 2 of a step by step guide on Sysprepping a Windows 7 machine from start to finish. I cannot take full credit on this because my first article had so many helpful comments and discussions that this is simply a combination of all the good advice written into a working guide. (I would especially like to thank George for his input on Cscript for auto activation and Nathan for input on Sysprep Audit Mode). This will guide you through the following:
- Audit Mode
- Building the unattend.xml file in WSIM
- copyprofile=true command to copy the default profile (no manual copy)
- Prompt for a computer name
- Enable Administrator account
- Administrator account logs in first time automatically
- Activate windows automatically with Cscript;
- Successfully copy over taskbar icons;
- Delete unattend.xml file automatically upon completion of re-image.
Here is a list of what you will need:
- Latest version of WAIK : KB3AIK_EN.iso Version 1.0
- Windows Vista or Windows 7 Machine to build the XML file on
- ISO or DVD of Windows 7 Installation (x32 or x64)
- WinPE Boot Environment : BrianLeeJackson WinPE 3.0 BootLoader
First we are going to walk through building the unattend.xml file (answer file) and then we will walk through the actual Windows 7 imaging process.
PART 1 – XML FILE CREATION
Step #1
If you have a Windows 7 installation DVD, insert it now. Or if you have an ISO of 7, go ahead and extract it to a folder on your desktop. (I recommend 7-zip).
Step #2
Launch Windows System Image Manager. Your start menu should look like the image below:
Step #3
Under the “Windows Image” header, right click and select new image.
Step #4
You will now want to browse to the .CLG file in your Windows 7 installation (I am using Windows 7 Enterprise x64 in my example). It is located in the sources folder. See Image below. You can select either the .clg file or the install.wim. Both will have the same result.
Step #5
Now we need to create a new answer file. Go to the file menu and select “Create New Answer File.” Right after creating one, go ahead and simply go to file menu and select “Save Answer File.” This will give your XML file a name and save location. I chose to name mine unattend.xml. Now you see we have two category folders, Components and Packages. Under the Components folder you see that we have 7 options:
-1 windowsPE
-2 offlineServicing
-3 generalize
-4 specialize
-5 auditSystem
-6 auditUser
-7 oobeSystem
Step #6
These are very important as these are the steps in which the unattend.xml file is sequenced.
The next part is a little confusing. You are going to add components, from under the “Windows Image” section on the bottom left hand side to the passes on your Answer File. To add a component, you can right click on them and select “add to # pass”. There are many different options you can add, but they have to be done in a certain order and pass otherwise your sysprep might fail. I am simply going to use the one I created as the example.
Here is more information about adding options under the passes:
1 windowsPE
Nothing required in my example.
2 offlineServicing
Nothing required in my example.
3 generalize
amd64_Microsoft-Windows-Security-SPP_6.1.7600.16385_neutral
Set 1 for SkipRearm to allow up to 8 rearms
4 specialize
amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral
Order: 1
path: net user administrator /active:yes
WillReboot: NeverRunSynchronousCommand[Order="1"]
RunSynchronous
amd64_Microsoft-Windows-Security-SPP-UX_6.1.7600.16385_neutral
SkipAutoActivation: true
amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral
Computer Name: Leave blank (we will deal with this at the end)
CopyProfile: true
Registered Organization: Microsoft (you must leave this in this section)
Registered Owner: AutoBVT (you must leave this in this section)
ShowWindowsLive: false
TimeZone: Pacific Standard TimeYou can delete other sub-header components if you don’t need them.
5 auditSystem
Nothing required in my example.
6 auditUser
Nothing required in my example.
7 oobeSystem
amd64_Microsoft-Windows-International-Core_6.1.7600.16385_neutral
InputLocale: en-us
SystemLocale: en-us
UILanguage: en-us
UserLocale: en-usamd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral
RegisteredOrganization: Your Company Name
RegisteredOwner: Your NameAutoLogon
Password: Administrator Password
Enabled: true
LogonCount: 5
Username: administratorFirstLogonCommands
CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (windows 7 license key)
Order 1
RequiresUserInput: falseCommandLine: cscript //b c:\windows\system32\slmgr.vbs /ato
Order 2
RequiresUserInput: falseSynchronousCommand[Order="1"]
SynchronousCommand[Order="2"]
OOBE HideEULAPage: true
NetworkLocation: Home
ProtectYourPC: 1UserAccounts
Password: Administrator Password
Action: AddListItem
Description: Local Administrator
DisplayName: Administrator
Group: Administrators
Name: AdministratorLocalAccount[Name="Administrator"]
AdministratorPassword: Administrator Password
LocalAccounts
If you have questions, look at my image above to see full layout of components, it should help.
Step #7
K, now go ahead and save your answer file as unattend.xml.
Step #8
If you want the sysprep to prompt for a computer name you need to remove a line from your XML file. Open up your XML file you saved with notepad and remove the following line:

Unattend.xml Computer Name
PART 2 – IMAGING PROCESS / RUNNING SYSPREP
Step #9
Install Windows 7 (Enterprise) from CD or USB flash drive, when you arrive at the welcome screen and it asks you to create a username, hit ctrl+shift+f3.
This will reboot your machine and put your windows build in ‘audit’ mode.
Step #10
On reboot, you’ll automatically be logged in under the built-in Administrator account. A sysprep GUI box will appear, but you can close it and NOW begin to customize your profile.
Step #11
Install any software/drivers, make any profile customizations, etc.
If you need to reboot, the computer will boot you back into the Administrator account. You will be stuck in this audit mode until you run sysprep with the /oobe parameter. After doing so, sysprep will delete/clean up the Administrator account, but if you have copyprofile=true in your unattended answer file, it will copy the customized Admin account to the default profile before deleting it.
Step #12
On the PC you are going to be running sysprep on, you need to create a folder called scripts in this directory: %WINDIR%\Setup\. Now you are going to create a CMD file within the %WINDIR%\Setup\Scripts directory. Right click and make a new text file called SetupComplete.txt. Remove the .txt extension and replace that with .cmd. You now have a SetupComplete.cmd file which windows will read the first time it boots up from the sysprep. We need to place a script inside the CMD file. Edit the cmd file with notepad and insert this line: del /Q /F c:\windows\system32\sysprep\unattend.xml. This script will delete your unattend.xml file after it has been used. The unattend.xml file is also copied to the C:\Windows\Panther directory, so you will want to add a second line to the CMD file, del /Q /F c:\windows\panther\unattend.xml. If you have passwords or cd keys stored in that xml file you don’t have to worry about it being left on the computer.
UPDATE AS OF JUNE 16TH: Read my Taskbar Icons Tutorial before continuing.
Step #13
Once you have everything configured correctly, Copy or move your unattend.xml file to : C:\windows\system32\sysprep. Now to run sysprep, navigate to that sysprep folder, hold SHIFT and right click and select “Open New Command Windows Here”. Next, input the following commands:
sysprep /generalize /oobe /shutdown /unattend:unattend.xml
Step #14
Turn the computer back on and boot to WinPE 3.0 environment (USB stick or CD/DVD). You can use my BrianLeeJackson WinPE3.0 BootLoader to boot up from USB or CD and capture your image. Capture image and save image to network location.
A Dell 960 or GX755 is a good standard for capturing when you want a generic image for use with multiple systems. Might require injecting additional drivers for 3rd party brands, HP, etc. Most should work though right out of the box.
Step #15
On reboot, Windows will run out of the box, as the /oobe is intended. As long as you put your cd key into the unattend.xml file, windows will be activated automatically in the background, you will be automatically logged into the administrator account, and the unattend.xml file is deleted. You are now ready to use the computer or join it to the domain. Enjoy!
Tags: Software, sysprep, unattend, unattend.xml, Windows 7, WinPE 3.0







Sean:
Did you check group policy settings? This happened to me as certain users (on the domain) were able to change their background, while others couldn’t. Turned out to be a group policy…which was odd because it didn’t have an issue in XP.
Hi guys
Hell with sysprep for Win7…eternal loading Windows
Have a very big problem with 2 win7 partitions. Here it is:
Create 2 partitions (ntfs) with Paragon – no disk free after – to do not have the dawn reserved partition from win7.
Install win7 english on the first one.
Install win7 french on the second.
Install SysCommander software to have boot menu at startup (for french and english). Students can choose the different os language.
If i ghost(with option the whole disk to keep partition table and mbr) and restore on a different machine, everything is fine
If i did a sysprep on either winfr ou win7en and ghost it, and i choose a selection in my boot menu, win7 stay at the loading screen for eternity.
It seems that sysprep reset, destroy, or change the boot.ini or the bootloader. Why??? Things was so sweet with XP!
Is there a way to configure the sysprep.xml or any others way to do not modify the boot configuration during sysprep?
I spent weeks and weeks of tests and it drive my crazy. I have to deploy 200 computers.
Any help would be very appreciated
Hi, when setting the time zone what is the correct working for UK time, ie; london …..
in this guide you have specified “Pacific Standard Time”
what is the correct working for what i need? UK time…
hi,
This is a big help for me, been searching this kind of tutorial for my new computer.
but after following the steps by step tutorial I can’t figure out the step 11 and 12.
Please help me not mentioning im newbee in this field.
my 1st problem?
” You will be stuck in this audit mode until you run sysprep with the /oobe parameter”
how can i do this? what command I need to run?
2nd problem?
and where can i found this folder “%WINDIR%\Setup\”
Thanking all of you in advance,
Ken
I am having problems running an unattended script with the language set to en-GB…
I have tried:
en-GB
en-GB
en-GB
en-GB
& the hex
0809:00000809
en-GB
en-GB
en-GB
But this always stops at the “My language is…” screen during the OOBE stage
I have set this to en-US to test and this goes through fine without stopping at the OOBE stage?
Can anyone help, thanks
When I boot from Cd using WinPE3.0 Contents_x64 i got a message select device is not available
but the Cd is inside the cd rom (and i know that cd rom its working).
Is there anything I did wrong or missing?
Everyone – Not to bash this thread but It took me about 10 steps in the wrong direction as far as the profiles went.
Easiest way to Ensure profiles are copied:
Build your base answer file, as you need then SAVE IT TO THE ROOT OF A THUMB DRIVE AS UNATTEND.XML – Without the caps obviously!
-Save it as autounattend.xml if you’re going to be auto activating
Make sure True is in the xml as well
Install Windows – It will automatically look for your unattend.xml in the root of any inserted thumb drives
DO NOT ENTER INTO AUDIT MODE!
Create your own theme and save it in the root of your windows folder make sure the theme section of the unattend file looks like this:
%windir%\glc.theme
glc.theme is my theme name, replace it with yours
Customize all other settings/proxies/applications
Once everything is the way you want it while logged in as the user you modified everything on browse to windows\system32\sysprep hold shift right click and launch a new command window from there. Then run sysprep /generalize /oobe /shutdown /unattend:e:\unattend.xml
-e:\ is my thumb drive path
I beat myself up over all this for a few days but I’ve consistently had perfect results with this method. EVERYTHING was copied over application settings/views/themes/the works.
Shoot me an e-mail if you have questions, I’m by no means a deployment expert but this part I have down! windexcs@yahoo.com
Everything works for me, but when the system boots up I cannot login. It seems that the administrator account is disabled for some reason. I followed the guide carefully, even started over from scratch. Anyone else have this issue? Suggestions? Thanks in advance!
Great guide! I’ve used this when building our Windows 7 images for deployment.
HOWEVER!
Bill F, have you found a soultion to joining the domain afterwards? I have the exact same issue. The PC shows itself as being a member of the domain yet when you log on you receive the error: “The security database on the server…” and the machine account is not created in AD.
Any help insights would be greatly appreciated.
Cheers,
EzG
THX for this brilliant guide.
If a german Windows deployment blog, if you interested check out http://www.eyeonwin.de
Hi.
First thanks for the very nice guide! It helped me alot!
But…
When I unpacks the image on a new formatted HD, it gives me the: “bootmgr.exe is missing” on first boot and I have to use repair disk to solve it… Can I do anything so the bootmgr.exe is working after I have captured the syspreped *.wim image?
thanks again,
Emil
[...] a Windows 7 Machine – Start to Finish V2 – http://blog.brianleejackson.com/sysprep-a-windows-7-machine-%e2%80%93-start-to-finish-v2 [...]
in step 4 specialize,
add amd_64_Microsoft-Windows-Deployment_neutral
RunAsynchronous
RunAsynchronusCommand
under Order, Value 1
under Path, add the value net user administrator /active:yes
Hi, when setting the time zone what is the correct working for UK time, ie; london …..
in this guide you have specified “Pacific Standard Time”
what is the correct working for what i need? UK time…
Great step-by-step, but when I deploy the image to another system I get an error from the Windows Boot Manager: Windows Failed to start. A recent hardware or software change might be the cause. File \Windows\Sytem32\winload.exe. Status 0xc000000f.
Hi, I am getting the
BOOTMGR is missing
Press CLT-ALT-DEL to restart
and I am also getting just before that it cannot find the sysprep.xml even though it is in the sysprep folder, and when I run winPE to do capture before all this when I select a drive to capture it says D: not C: but I made sure the partitions where correct before ending the Audit mode.
Ross, try Greenwich Mean Time.
Ken, the “%WINDIR%” directory is the directory where Windows is installed, so C:\Windows\Setup = %WINDIR%\Setup
Kye, try running the following commands after you “applied” the image to your hard drive:
bcdedit /set {default} device partition=c:
bcdedit /set {default} osdevice partition=c:
bcdedit /set {bootmgr} device partition=c:
I also found, since I’m using a MLK, I can change and validate the product key I can skip the following steps:
● FirstLogonCommands
SynchronousCommand[Order="1"]
CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (windows 7 license key)
Order 1
RequiresUserInput: false
SynchronousCommand[Order="2"]
CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ato
Order 2
RequiresUserInput: false
I still haven’t been able to automatically add a PC to the domain, but I’m working on it.
Brian,
I neglected to say “thank you” for all your hard work creating the tutorial. I was a wiz at Windows XP Sysprep and I NEVER would have been able to figure this out on my own.
Also, I hope you get well soon!
Thanks again.
I’m having trouble validating. I get the message:
“Setting SkipRearm is deprecated in Windows image”
Same message for SkipAutoActivation as well.
Can anyone assist? thanks.
instead of putting
InputLocale: en-us
SystemLocale: en-us
UILanguage: en-us
UserLocale: en-us
as this will set the keyboard etc to US is there a way of making it for the UK?
Thanks
to solve the problem with BOOTMGR is missing and the install being captured from the D: drive (because of thw 100MB partition windows 7 creates) format the drive from the install iso/ CD before then installing 7 . This seems to put all the boot files required on the system partition that you capture with GImageX.
I can’t get the copy profile=true to work i want to copy the administrator profile to default user and i get an error everytime
Windows cannot parse or process the unattend anser file for pass [specialize]
Hi There
This is a great guide and really got me on my way to getting a decent image rolled.
1 thing I’d like to point out is the SLMGR.exe commands. You have:
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXX
but it should be
slmgr -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXX
Not sure if the / and – make a great difference, but I know the last lot of machines I built failed to activate until I changed this.
To avoid the 100MB partition that Windows 7 automatically creates (which leads to the Bootmgr error mentioned by ConH), prior to starting the original Windows setup when installing from the original DVD (Step 9), press Shift + F10 when prompted at the EULA screen, and run:
diskpart
list disk
select disk x (where X is the drive you want to install to)
clean (this will wipe your HDD without warning, so make sure you are on the correct drive)
create partition primary
active
assign letter=c
format fs=ntfs lablel=”C on Localhost” quick
exit
exit
This will create a single NTFS formatted partition that you can install Windows 7 to, **without** the 100MB system partition.
dcc
Thanks Brian! Greatt blog – helped me alot with some of the questions I had concerning win7 sysprep and imaging as I study for MCTS exam 70-680.
Do you have anything on Windows 7 64 Bit? Having trouble with building the unattended XML file. Any help would be great.
Thanks
I’ve run sysprep and have read using a * in place for computername will randomly generate a computer name for me however when my machine boots up after running sysprep I am prompted to enter one.
Any suggestions on where else this could be getting triggered?
Do I need an answer file? Or can I just run sysprep in the sysprep folder with Generalized checked?
Hi
Thanks for all the tuturial its very useful and it works perfectly with some ajustments along with it.
Thank you very much.
I have a favor to ask you if you dont mind, i see you understand alot of sysprep and i think your the one who can help me… Ive been trying to sysprep windows xp for a long time ago, but i can only do it in IDE disks and not SATA, all my tests for sysprep SATA have failed, can you help me making a sysprep running on SATA disks? ill be super thankful.
Please contact me later.
Thank you. GozU
I am using ImageX v.2 to save the image. However it is asking for a source .wim file. I am not sure where it is after running sysprep. Any help would be greatly appreciated. Thank you.
First I would like to say thanks to all that contributed to this wonderful tutorial on Windows 7 sysprep. However, I am having a little issue that hopefully someone here can help me address. Upon deploying my new image to a PC I am finding that no matter if I set a password for the admin account that I copied over from the sysprep it will not prompt for a password upon reboot. Does anyone know why this is happening? Thanks in advance for the help!
Followup to my original Reply:
I previously stated to run sysprep as the user you configured everything with. This is not the case:
Once you load Windows, create a user, login and don’t use audit mode. Enable the Administrator Account and login to it.
Customize the administrator profile and delete any other local profiles.
Sysprep while logged in as Administrator
(MAKE SURE WMPNTWKSRV.exe IS NOT RUNNING)
[I actually disable the windows media player network service - saves u having to stop the process before sysprep]
I may have got the name wrong but it’s close, It will cause fatal error when trying to sysprep!
*Profiles are copied in the specialize phase (not while sysprepping!) SO! Make sure your unattend file for deployment also has the true in it!
This must be in root of thumb drive in PC, In your MDT deployment share or in your sysprep directory
As always, shoot me an e-mail for questions windexcs@yahoo.com I’ll eventually write up my own complete guide once i get my MDT server built and use that method for deployment (makes domain joins much easier as well!)
To join a domain, I copied the Win7 version of netdom to the image PC. To get netdom you’ve got to download a Server 2008 admin pack or something similar. Then under oobeSystem Windows-Shell-Setup FirstLogonCommands I added a command to run netdom. It uses NETDOM JOIN %computername% and then supplies the necessary account info. Luckily %computername% worked in getting the current computer name.
Here is my xml file I can’t copy administrator profile over default user i keep getting the error:
Windows could not parse or process the unattend answer file for pass specialize The settings specified in the answer file cannot be applied The error was detected while processing settings for component
it only happens when i have copyprofile set to true. Any help would be greatly appreciated.
Eastern Standard Time
true
1
net user administrator /active:yes
http://audgenoag/Intranet/index.cfm
true
1
true
true
en-US
en-US
en-US
en-US
bQBpAGMAcgBvADEAUABhAHMAcwB3AG8AcgBkAA==
false
true
5
administrator
1024
768
1
cscript //b c:\windows\system32\slmgr.vbs /ipk license key
false
2
false
cscript //b c:\windows\system32\slmgr.vbs /ato
Work
true
1
bQBpAGMAcgBvADEAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBQAGEAcwBzAHcAbwByAGQA
false
bQBpAGMAcgBvADEAUABhAHMAcwB3AG8AcgBkAA==
false
Administrator
Local Administrator
Administrator
Administrators
Eastern Standard Time
false
Has anyone had any luck getting the computer to join a domain after sysprep? I can get the pc to ask for a name to be entered but have had no luck with it auto joining the domain.
Jason, you need to run sysprep in audit mode to get copyprofile=true to work.
now that I already have the image created ready to be syspreped can i run it in audit mode or do i have to start all over from scratch?
First off all, thanks for the great guide! Very usefull.
The only thing I found is that you should choose install.wim in waik and not the clg file. You will have errors if you try to reopen the sysprep.xml file.
I am wondering why we need to run sysprep at all. I have imaged over 3500 XP computers without ever running sysprep and they worked just fine. What does sysprep actually do other than remove the special settings that you want the users to have? Is it true that Bill Gates gets a spiff every time someone runs sysprep?
I’m having the same problem as Jason. Get a message when I reboot the sysprepped computer that specialize pass can not be processed that there is an error in amd64_Microsoft-Windows-Shell-Setup_neutral
In Audit mode can we join a domain and log into the domain as a domain user? I install most of the software needed from domain shares.
Sysprep seems to be a good concept. Is there any way to stop before your step 7, rename the sysprep file to Autounattend.xml and run it with the virgin OEM DVD? When I tried this the EULA still appeared, My Autountend.xml didn’t transfer the computername, and I have not been able to set up a workgroup.
Please help me?
thanks in advance – Lee
Ok just recreated a brand new image using audit mode and ran sysprep and seemed to work with just a basic image. But as I finally finished all my updates and personalizing it the way our office works ran sysprep again as stated in the tutorial. I am getting the error.
Windows could not parse or process the unattend answer file for pass specialize The settings specified in the answer file cannot be applied The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup].
what is going on? why wont it work?
hi guys,
followed all the steps, the sysprep ran, but when the machine boots after i restart it the graphic drivers are missing!
all the programs etc are there, i dont understand what went wrong.
can any one help?
After sysprepping and putting my image on a machine I get the “Select your network location” prompt once logged in; the prompt that asks you to select either Home, Work, or Public.
But I have the following in my sysprep.xml file:
# OOBE
HideEULAPage: true
NetworkLocation: Home
ProtectYourPC: 1
Any thoughts as to why its doing this?
I am having trouble with getting the script to delete the sysprep.xml after it images. Everything else has worked fine for me. I created a folder called scripts under the windows directory in the setup folder. Then I created a new text file called SetupComplete.txt. Remove the .txt extension and replace that with .cmd. Then I edited the cmd file with notepad and insert this line: del /Q /F c:\windows\system32\sysprep\sysprep.xml. But after a image a pc the my sysprep.xml file is still there. Any ideas or what did I do wrong.
How does all of this apply to Windows 7 imaging using WDS? I found that in most cases the “sysprep” answer file is ignored when using WDS and that you use an XML file on the WDS server to do unattended installations. God… this whole process makes my head hurt.
Do you have any idea why Windows is not deactivated after sysprep? (It was activated before sysprep with a Win 7 x64 Enterprise MAK key)
@Jason:
Have you deleted a user account & user account folder?
Check this registry key for any accounts that do not exist anymore and delete them before sysprep:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList
@Kalle
Ok I just started over and everything seems to be working so far. What I have been doing this time is setting up some of my apps ghosting my machine testing sysprep and if it works i move on to reimage the machine and contine installing my apps. I am almost done so hopefully it will be all set. The only problems I am having now is that the quick launch toolbar doesn’t stay also when I drop the image to the machine from the network using ghost it fails booting getting Windows Boot Manager and I have to boot to the installation DVD and run repair restart. Any ideas on why this is happening would be greatly appreciated.
Thanks for the great documentation really great….Just a question do you guys know if we are able to make it prompt for a domain ?we have sevaral domains(Different clients) so it would be nice if we can get the Windows 7 sysprep to prompt the domain.