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 Time(Please view TimeZone settings here -> http://technet.microsoft.com/en-us/library/cc749073%28WS.10%29.aspx)
You 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:windowssystem32sysprep. 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









@Marko Kuipers: That is perfectly fine! The knowledge is meant to share with everyone. All I ask is that you put a link back to my blog somewhere in the fine print or references of source documentation. Good luck!
Getting this error on Step 13:
Windows could not parse or process unattended answer file [unattend.xml]. The specified file does not exist.
Any ideas why, spelling is correct and the unattend.xml file is under C:\windows\system32\sysprep.
xzn2p3:
You need to run sysprep.exe from the same location your unattended.xml is.
copy unattend.xml from wherever to “C:\Windows\System32\Sysprep
then:
cd C:\windows\system32\sysprep
sysprep /generalize /oobe /shutdown /unattend:unattend.xml
@xzn2p3: The reason you are getting that is becuase you need to edit the settings. you cant just add that stuff over to the answer file. for expamle this one below. to get the RunSynchronousCommand[Order="1"] you will need to right click on RunSynchronours and select Insert New RunSynchronousCommand. then the windows to the right of that where the properties is where you can edit and make changes as needed. hopefully this will help you and others.
4 specialize
amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral
1.
1.Order: 1
path: net user administrator /active:yes
WillReboot: Never
RunSynchronousCommand[Order="1"]
RunSynchronous
Hello, congratulations, I want deploy win 7 in my organization but i am not sure ho can i do…please help me… i dont now how start !!!!!!
thanks
oscar castro
bogota – Colombia
xzn2p3: I’m having the same issue, I’m not sure what’s causing this either. Nicoli & Tim, I verified that my unattend.xml is configured correctly, based on your comments and the file is in the same folder as sysprep (per Brian’s instructions above), but I’m still receiving this same error.
Any other thoughts?
It would be helpful if you explaned what these commands do! or how to add them. Enables the Local Administrator
4 specialize
amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral
1.
1.Order: 1
path: net user administrator /active:yes
WillReboot: Never
RunSynchronousCommand[Order="1"]
RunSynchronous
The reason you are getting the parse issue is because you are not running the sysprep command in audit mode. I was getting the same error until I rebooted Win 7 into Audit Mode. Simply go to a command prompt from the System32\sysprep folder and type sysprep /audit. Once the system restarts, enter:
sysprep /generalize /oobe /shutdown /unattend:unattend.xml
This should work.
Brian’s XML procedure works nicely, but if I have my network cable connected once I go to image the system, my computer comes back automatically joined to our Domain. I can stop this from happening by unplugging the network cable after the new imaged computer gets it’s image from the network, but what can I add/change to the XML file to prevent this from happening so it never automatically joins the computer to the domain and starts back up into the local workgroup and not the Domain?
With regard to H:\My Documents; registry hack to put it back to default settings and let the whole thing get handled by the network admins via Group Policies.
Now I’m off to figure out why some builds deploy just fine and others refuse to behave . . . happy holidays!
I was ablt to run sysprep after changing the path to:
cd C:\windows\system32\sysprep
sysprep /generalize /oobe /shutdown /unattend:c:\windows\system32\sysprep\unattend.xml
I captured the wim file but when the system reboots and runs through its step It comes up with an answer file error reboots and then stays in the endless cycle of telling me something went wrong. I read that OOBE/SkipMachineOOBE and OOBE/SkipUserOOBE both need to be set to true.
Here is a link to a post that may help some get rid of the freq used prog’s that are pinned to the start menu by default by MS. Worked for me anyway. Thanks JuliusPIV where ever you are and thanks to Brian. May all your traffic lights be green.
http://social.technet.microsoft.com/Forums/en/w7itproinstall/thread/73eb1c0a-fc78-4ae7-ba6d-356d9a9a5328
This is the error I’m getting:
Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [oobeSystem]. The settings specified in the answer file cannot be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-setup].
Is it possible that the answer file should be under C:\Windows\Panther instead of :\windows\system32\sysprep?
I have Dell Optiplex machines ranging from 260 to 780. I recently learned through trial and error on creating a single image using sysprep with Windows XP. Now that we are planning to go with Windows 7, how do I go about creating a single image for these different type of models on Windows 7, do I still use sysprep or does Windows 7 have a another way to accomplish this task without using sysprep? I read some on dism, distribution share, windows PE, etc. all confusing me. Thanks.
Hi;
We have been working on a creating sysprep image for a global Windows 7 roll out and have been struggling getting the initial image created. Until reading this post we had been missing this vital step in creating a W7 sysprep image. We have done this on many occasions for Windows XP deployments without issue so it seems the process that you need to follow is slightly changed.
Up until reading this post we installed W7, created a username/password, configured the software and agents needed in the image. We are using Symantec deployment solution to create the sysprep image and will also be using this for deployment. Each time we created an unattend.xml using WAIK, we were getting the standard error “Windows could not parse or process unattend answer file\….” and going round in circles.
The key to getting this to work for us was to Install a vanilla W7 OS and at the point where you create the username and password boot the computer into Audit Mode (Ctrl/Alt F3) and **THEN** install software/agents etc.. Only at this point could we successfully run the sysprep /generalize /oobe /shutdown /unattend:unattend.xml
Once this has complete, we then took an image of the machine in its sysprepped state with Symantec deployment (after the shutdown) and we have now re-deployed this back to other machines including the laptops we are going to be deploying too.
One thing we have noticed as Windows 7 uses the same shutdown mechanism as Windows 2008 (i.e. if you don’t enter a reason code for shutdown, the next time the computer boots it complains that the previous shutdown wasn’t expected, does anyone on here know a way of suppressing this.. maybe with some extra syntax on the sysprep /generalize /oobe /shutdown /unattend:unattend.xml command??? However, this maybe a bug in the /shutdown parameter on the sysprep.exe..
The only other thing we need to sort are some driver issues (as usual)
Great Post, got us out of a hole!!!!
Ian
Help me think this out: what happened between steps 8 and 9?…i followed all the steps up to 8 but now it says to install? install where on different computer? why? not understanding why the install? cant i run sysprep on the same macdhine i created the unattend.xml? if not, then i am guessing i need to copy some folders that contain the xml file?
Great article! I’m just starting to look at automating Windows 7 deployment and this is a great starting point. I was wondering how you decide which pass to add different components too. Also has anyone found a good source of documentation on the various components you can add to the answer file?
Are the unattend files 32- or 64-bit dependent? In other words do I need to create separate files for the two versions.
I’m seeing exactly the same error as xzn2p3 does: “Windows could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [oobeSystem]. The settings specified in the answer file cannot be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-setup].”
The only thing I did different is the Time Zone: instead of ‘Pacific Standard Time’ I put ‘Romance Standard Time’.
@PaulM: Yes, the two files are completely separate. You will have a x32 XML answer file and a x64 XML answer file.
@edv: As far as the components go, this was all trial and error. I have yet to find a good place with Windows 7 component references. If you find a good reference, please post back with it!
What does the cscript //b c:\windows\system32\slmgr.vbs /ipk do??? i dont think i have a file like that.
•FirstLogonCommands
1.CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (windows 7 license key)
Order 1
RequiresUserInput: false
CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ato
Order 2
RequiresUserInput: false
Thanks Brian for the informative post.
I am mostly interested in the step 8 of your instructions i.e. getting prompted for the computer name. Has this been test and known to work? I heard sysprep at that stage of the process has already joined the machine in to the AD and the computer name you enter at the prommpt is only used to rename the computer; which causes trust issues later. This was certainly the case with VISTA.
Can you please confirm this or suggest other workarounds?
When changing info in the answer file can I replace the old answer file in the wim by mounting it and simply overwriting it or do I have to create a whole new wim file for that answer file?
Sounds like great instructions, but I can’t even find a folder named ‘sources’ or ANY file with the extension .clg, nor any images. The only ‘image’ I have is the hard drive with Windows 7 installed and there are no images available to select. When I run sysprep all I get is an error about “Windows could not finish configuring the system. . . ” Found this page while trying to solve the sysprep issue. AIK is installed on Dell Prec 1500 win7 x64. Target machine is Dell OptiPlex 380. . . .
Sorry, to clarify my last post instead of saying:
“Has this been tested and known to work?”
I should have said:
“Has this been tested and known to work when sysprep is used to join the computer into an AD?”
[...] Sysprep a Windows 7 Machine – Start to Finish V2. [...]
The issue with the answer file I had was that I had to build it with the same type of OS I was building it for. I build a Win 7 x64 machine, installed AIK and build a new answer file with a bit more stuff going on and it works like a charm.
After booting up to Audit Mode, can you still get networking as I am trying to install software that is on the network.
Thanks for this walkthrough. I am excited to try it for the first time. However, I have a question. I have successfully added the first component in Step #6 under Specialize (except mine is x86 as I am using that architecture). However, when I do so, mine looks different in two ways – #1, it adds three options under it ExtendOSPartition, RunAsynchronous, and RunSynchronous. Should I just delete the first two so it is only left with RunSynchronous like it is in your example? Also, I do not have any of the options that you are stating should be under that RunSynchronous properties. All I have is AppliedConfigurationPass (4 specialize)
Enabled True
ID x86-Microsoft-Windows-deployment-neutral
language neutral
Microsoft-Windows-Deployment
ProcessorArchitecture x86
PublicKeyToken 31bf3856ad364e35
Version
VersionScope nonSxS
Im trying to seal a windows 7 image but i need that when it comes back up it will log automatically to a domain with a standard domain account and a local admin account ive been trying it but i keep getting stock on where do the values go any help is appreciated
I hope someone can help me. This is my situation: I follow the whole guideline above and run the sysprep. When the image has been made, I boot the computer. Windows is starting up and then the services start. Here a window pops up and tells me: “the configuration of the system cannot be completed. You can try to restart the configuration to restart the computer.”
I have to mention: this is what I translated. I work with Windows 7 Pro Spanish.
When I reboot, I get the same message and so my sysprep get stuck on this moment.
Someone who can help me?
Thanks a lot!
This is incredibly confusing. With Windows XP, all I would do was create folder in root of drive called Sysprep. Then, on the Windows XP install disk, open Deploy.cab file, then copy setupcl.exe, setupmgr.exe, and sysprep.exe. into the Sysprep folder I created. Then I would go to Sysprep folder created, click on sysprep.exe and Sysprep window would open. I would tell it to reseal installation, and tell it to shutdown computer. Then I would use Ghost boot disk and create image of the install and then clone that image to new machine. Once new machine was powered on, it would go through the steps, INCLUDING asking for a computer name. This is the process I am looking for as far as Windows 7. I don’t mind answering questions, I just want to be able to have as simple a procedure for Windows 7 sysprep. Is that a reality? Having to install this, and install that seems sort of unneccessary for what I want to do. Does anyone know the synonymous files to copy in from Windows 7 DVD?
Built a Win7 x64 Ent image…I have tried to sysprep 3 times. When it runs the minisetup, I get “windows could not finish configuring the system. To attempt to resume the configuration, restart the computer.” The same image without sysprep boots fine. I didn’t add amd64_Microsoft-Windows-Security-SPP-UX_6.1.7600.16385_neutral
SkipAutoActivation: true
under 5 auditSystem
I did add amd64_Microsoft-Windows-PnpCustomizationsNonWinPE_neutral
key 1 and path c:\sysprep
I just let our kms take care of activation. What the heck am I doing wrong? I followed the v1 of this doc for the 32-bit image and all was well
Brian,
Do you have any tips on adding device drivers to a sysprep image? Some of the newer Dell models have on their website all the relevant pnp drivers in one zip file. It would be nice to incorporate that into the image so that no matter what device options are on the computer, the image could install it, and avoid having to do this after imaging the computer.
Thanks for a great website!
Do you suppose you could add this link near the “timezone” part of the instructions?
http://technet.microsoft.com/en-us/library/cc749073(WS.10).aspx
I am in the Arizona time zone but it turns out that the time zones display name is not always what you need to put into the unattend.xml file.
@Carls: Thank you for the comment CarlS… I have added that to the above instructions.
@xzn2p3
On my configuration too, I need to put my unattend.xml file in %windir%\panther folder also.
So… that’s the only hack I needed to this great tutorial.
Great job
@Brian Jackson: I am having the same problem as @PaulM with drivers not being there after I reboot after I run sysprep. What the heck is up with that? It seems the NIC driver stuck but nothing else :-S… How can I include these drivers without doing something like nlite? Thanks for the great write up! Everything else worked like a charm including my added line to autojoin the domain…
Regards,
Robert
Thank you Brian for the excellent guide. Sysprepping Windows 7 seems to be a daunting task for those coming from XP, but really it’s pretty nicely done.
Thanks again!
[...] Her’s a good little walkthru on Brian Lee Jackson’s site [...]
Thanks – I have used your excellant procedure to deploy Win7 at several sites, always with great success.
Question – I’m trying to tweak the unattended.xml in order to have it prompt me for a license key rather than having one embedded in the unattended but have been unsuccessful. Any ideas on how to achieve this?
Thanks, been struggling with this for a while. This tutorial helped a a lot!
Thanks for the great guide.
I’m confused about what key to use with our OEM Dells.
Previously under XP, MS had a generic key you could use with OEM systems.
What key should I be using for Win7?
Great walkthrough. It worked just fine for me.
I have a question, where can find this “copyprofile=true” in the unattend.xml?
Also, I found out that the “/generalize ” sysprep switch is requiered if you’re going to use WDS 2008 to capture your image. Without it, WDS won’t be able to detect the volume. But if you use that switch it will “generalize” all your drivers. Has anybody experienced this? What if I don’t want to use “/generalize” because I want to keep all my drivers, is there a way to sysprep a W7 computer without that switch and would still allow WDS 2008 to see the volume?
Thanks!
Thank you again Brian. We have now imaged over 3000 machines with the image created from this tutorial. It was a tremendous help in helping us get going. It was clear, concise and to the point. Thank you so much for posting this.
This guide could be exaclty what i am loking for to setup our systems instead of using clonezilla but i noted that it references and amd64 based system and we use and intel x64 based system. does this matter?
Thanks for your excellent deployment guide… you made my life easier!
Question: Win7 creates the system reserved partition. How do I capture that with GImageX automatically when creating the image file.
Right now I’m using Ghost to capture both partitions on the drive and make it into 1 image file. I want to get away with GHOST and start using WIM.
This is the most confusing thing that Microsoft has ever done to us. Even with this article, which many here have found useful, I am completely unable to understand the procedure. There is no good reason why I have to spend days figuring out how to create a modified default user profile to save myself a few minutes’ work per machine.
This article mentions a “source” folder, which my Windows 7 installation doesn’t have. It shows the Windows AIK in the Start menu, but doesn’t explain how it got there. I assume I’m installing the WAIK, but on which machine – the source machine? After spending an hour scouring the internet for a way to create a modified default user profile in Windows 7, I am giving up.
As others I have come across have said, Microsoft is turing their back on us by putting such things out of the reach of all but those with a lot of enterprise experience. Wake up – there are those of us out here without thousands of users who still need to save time managing these bloated products.
Thanks for your efforts here Brian, but I don’t have the time to decypher what you’re trying to say.
I have followed the steps above and it’s working great. However, I can’t seem to get the auto login with the Administrator account to work. I set it to auto login twice as the Administrator. It tries to auto login twice but fails with “The username or password is incorrect” error. I can manually type in the password that I set and it logs in fine. Any ideas on how to resolve this?