How to Sysprep in Windows Server 2008 R2 and Windows 7
Note: This post discusses Sysprep as it pertains to Windows 7 and Windows Server 2008 R2. If you’re working with a different version of Windows, check out these posts:

About eighteen months ago, I blogged about how to run Sysprep for Windows Server 2008 and this has turned out to be the most popular article on this site by a long shot, so I figured I'd update it for Windows Server 2008 R2 (and Windows 7). If you never had the need to look at Sysprep in Windows Vista/2008, you'll find that it's nothing like what you're used to on Windows Server 2003, XP, etc.

The first step is acquiring the Windows Automated Installation Kit (WAIK) and installing it on a machine. It will run fine on a Windows Vista or Windows Server 2008 machine. You can get it from Microsoft's website at http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=696dd665-9f76-4177-a811-39c26d3b3b34.

The tool of choice is the Windows System Image Manager (WSIM). When you start it you'll get a blank screen like this:

The first step is to open the image file for the Windows SKU you want to build a sysprep file for by going to File>Select Windows Image:

Note: You may need to first create a catalog file before completing the preceding step. In order to do this, you'll first need to copy the install.wim from your installation media DVD sources folder to the hard drive as the tool won't work with it if it doesn't have write access to the WIM file. You can then go to Tools>Create Catalog and create the catalog file.

All of the settings you will want to setup in your unattend.xml file are in the tree under Windows Image. The documentation for all the settings can be found in the Unattended Windows Setup Reference CHM file which ships with the WAIK. This link http://technet.microsoft.com/en-us/library/cc749272(WS.10).aspx shows a mapping table between the sysprep.inf file and the new unattend.xml format. This link is for Windows Vista but it still applies.

All of the various settings can be applied during different passes of the setup process which sysprep will trigger. You can read about these passes here. I built a simple unattend file just for sysprep'ing my base image which includes settings in the generalize, specialize, and oobeSystem passes. All of the settings I chose are outlined below.

My answer file tree:

Disabling the initial configuration dialog:

Disabling Server Manager from loading at first run:

Setting the Internet Explorer homepage to "about:blank", turning off the IE8 Accelerators, and disabling the first run wizard:

Setting Google as my default Search Provider in Internet Explorer:

Note: To do this, you should right click on SearchScopes and Insert New Scope.

There are two versions of Internet Explorer on a 64-bit machine – the 64-bit IE and the 32-bit one. You'll need to set the settings for them independently. Duplicate the above IE configuration in the wow64_Microsoft-Windows-IE-InternetExplorer_neutral component:

Setting my product key, timezone settings, and my name:

Configuring localization settings – if you want something other than US English, look under Input Locales in the index of the Unattended Windows Setup Reference CHM file referenced earlier:

Configuring the screen resolution and color depth - 1280x960 is what works for me in VMWare full screen mode with the tabs across the top:

Configuring setup not to show me the EULA again:

Configuring setup to install a default local administrator account password:

One of the things that's unlike Sysprep from Windows 2000 – Windows Server 2003 is that the unattend.xml file isn't deleted at the conclusion of the Sysprep process. The down level Sysprep deletes the c:\sysprep folder when it finishes. In order to replicate this functionality, you can put a command in to delete the unattend.xml file in the SetupComplete.cmd batch file (which must be located in c:\windows\setup\scripts\) which gets called at the end of Sysprep.

I put a simple one line command in my SetupComplete.cmd file:

del /Q /F c:\windows\system32\sysprep\unattend.xml

In order to run Sysprep you'll need a new command. The old Sysprep UI that was there in Windows 2000 - 2003 doesn't really exist anymore. All of the Sysprep command line switches are documented at http://technet.microsoft.com/en-us/library/dd744330(WS.10).aspx.

sysprep /generalize /oobe /shutdown /unattend:unattend.xml

Posted Sunday, October 04 2009 3:42 PM by Brian Desmond | 26 Comments
Tagged as: , , ,

Comments, Trackbacks, & Pingbacks

#1 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Sunday, October 04 2009 11:37 PM by Eduardo Antunes

Hey Brian, once again it's an awesome article! You're the reference for several other websites. Great job!!!

I've one question only. For those like me that want to prepare a base VM OS image for tests purposes. How can I sysprep a Win2K8-R2 image that already was activated without loose the activation? I mean, when I use the generalize option, it's cleanup and I need to activate it once again. In the other hand, if I don't use it the SID won't change as well as several sysprep configs won't be applied.

Thank you.

#2 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Sunday, October 04 2009 11:39 PM by Brian Desmond

I don't know how (if) you can skip activation - it's never been something I've had to worry about.

#3 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Monday, October 05 2009 12:13 AM by Eduardo Antunes

Howdy, you're fast to answer... LOL

But I can be faster too. ;-)

Just found how to figure it out.

Remove Computer-Specific Information from Your System (Generalize) technet.microsoft.com/.../dd799233%28WS.1

"If you anticipate needing to generalize the computer more than a few times, you can specify that the Windows Software Licensing Rearm program be skipped:

1. Set the Microsoft-Windows-Security-SPP\SkipRearm unattend setting value to 1. This specifies that the computer will not be rearmed, and it will not be restored to its original, out-of-box state. All activation-related licensing and registry data will remain and will not be reset. Similarly, any grace-period timers will not be reset."

I have tried it in my VMware environment and it works great. Just add the "Microsoft-Windows-Security-SPP" to "3 - Generalize" at AIK and set the "SkipRearm" to 1.

I hope that it help somebody else that needs that like me. Very useful for lab class training environments.

See ya and thanks once again.

#4 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Wednesday, October 14 2009 9:14 AM by Matt Gibson

I see that you put some configurations in the specialize pass, but in the command only the /oobe and /generalize triggers are set. When do the specialize settings run?

#5 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Sunday, October 18 2009 7:59 PM by matt

Why not just use C:\Windows\System32\sysprep????

I just need to sysprep a base isntall of the OS to spin up a virtual environment. I don't need to worry about the complexity and hassel of all those default settings. The link about not having to re-activate is very useful thought, saving that tidbit off.

#6 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Thursday, November 19 2009 2:31 PM by Mark

I'm planning on trying this out soon, but I had a question regarding sysprep in general...

On a Windows 7 box I have, I run it through the command prompt with generalize. After it is entered, the GUI form of Sysprep pops up. I choose audit mode, generalize, and then for it to restart. The PC goes through sysprep, restarts, and then, up on bootup, auto logs into the default admin account (which I don't use) and re-displays the sysprep GUI. It happens, from then on, everytime I start up WIndows. Anything I can do or am I doing something wrong?

#7 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Monday, January 04 2010 1:58 PM by Irfan

I am trying to create a image of windows 2008 r2 on a virtual machine, but apparently i am getting this 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].

I followed the article and used the simlar settings with my company relevant values.

#8 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, January 05 2010 8:39 AM by Irfan

It was the computer name which was giving the problem. I was using the wild character * so that it generates computer name but for some reason that was not working, once i used simple computer name like win2k it worked. Now i am trying to find what wild character we should use to generate automatic name in the format we want

#9 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, January 05 2010 5:43 PM by Jon Walker

Up to Win2K3 you cold edit the sysprep.inf file after with a new name, domain info, IP, etc then have the system boot without touching it.

In Win2K8 it seems it uses the unattend file as you sysprep and editing the file before you boot back up doesn't work.

Or am I missing a new step?

#10 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Thursday, January 28 2010 3:44 PM by Tim

I have about 40 Lenovo All-in-one computers. They are preinstalled with Win7 Pro. All I want to do is to adjust a default profile so I can image what I already have. Is this no longer the case?

#11 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Saturday, February 20 2010 10:11 AM by Byron

I have 30 windows 7 pro machines. Dell Optiplex 380's.

In XP I just ran sysprep to join the domain, give the computer a random name, pass the key code and run a script at the end to setup security for domain users on this computer. Very easy.

This sysprep for windows 7 is not that simple for me. Basically I setup the first computer just like I want it. It is on the domain, all my applications are loaded and ready to go. I use ghost 11 to ghost the machine.

I need an answer file to just sysprep the machine, then I would ghost it to my network. I would then run ghost on my new identical pc to restore the image. Then boot that machine and it runs through everything for me. Only thing i had to do in XP is log in as the domain administrator once it finished its unattended bootup. Once I logged in as administrator, it would run the one time script to add domain groups to the security groups of this machine.

I need help with answer file and with command for sysprep. I have read many documents and they all seem to have much more then I need. Any advise would be greatly appreciated.

I am new at most of this.

#12 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Saturday, May 22 2010 2:44 AM by Tirou

Hi Under WAIK the components are shown up as 'amd...' Will it also work for Intel based machines?

Thanks

#13 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Saturday, May 29 2010 10:18 AM by Reg E Barclay

Tirou: amd64 refers to the x86-64 achitecture and as such includes any Intel x64 processor. If your Intel machines have 64 bit processors, then it will work.

#14 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Monday, June 07 2010 6:25 PM by yiping

A great article on prepare an image for cloning. But what about configuring clones?

Here is my use case:

I have created a master image, and sysprep'ed it as described in this article for cloning. When I creating a clone in an attended set up, I want it to come up with a new identity: name, user accounts,, domain membership etc. So I generate a new sysprep.xml file for it, specifying all the infor needed for its new identify. Now my question is where do I save this new sysprep.xml so that it can be used to configure the clone? Obviously, I can't copy it into C: drive !

Thanks

#15 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Thursday, June 10 2010 8:41 AM by Brian

This is what i don't understand. why can't i just use sysprep by itself?

all i need is a base image, with a modified bitmap bacground, and modified local administrator and guest account, and several other taskbar setting, which i lose after completing sysprep with generaize option.

#16 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Thursday, June 10 2010 9:20 AM by Frank

Hi, I used sysprep on win w2k8 R2 , after the reboot Iget :

Autochk program not found. Skipping autocheck.

And my server keeps rebooting

Any idea ?

#17 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, July 13 2010 11:42 AM by Mike Larios

Found this to be very helpful in creating the syspreped image for Ghosting. Thus have had success with doing such, however I found that using full path names to C:\Windows\System32\Sysprep\Sysprep.exe /shutdown /oobe /generalize /unattend:"C:\Windows\system32\sysprep\yourfile.xml"

This seems to be the secret for a lot of the issues that I have seen being talked about in the forums.

Thanks Brian for the good how-to...

Mike

#18 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, July 13 2010 11:46 AM by Carl Johnson - Sacramento PC Pros

Maybe that's what I'm missing. Thanks Mike! I'll give this a shot.

Carl.

#19 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, July 13 2010 11:48 AM by Carl Johnson - Sacramento PC Pros

Maybe that's what I'm missing. Thanks Mike! I'll give this a shot.

Carl.

#20 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Tuesday, July 13 2010 12:09 PM by Carl Johnson

That was it "the magic sauce!" It fixed my issues. You da man!

Thanks.

Carl.

#21 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Monday, July 19 2010 5:45 PM by Rick

Downloaded iso for AIK for Win7/2008 R2, burned DVD and installed AIK on a Server 2008 R2 instance. Try to create catalog from C:\Program Files\Windows AIK\Tools\PETools\amd64 and it throws error 0xc1420127.

There is no install.wim on the DVD to copy to the hard drive, nor is there a sources folder on the DVD.

#22 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Monday, July 19 2010 7:22 PM by Brian Desmond

Rick-

The install/wim/sources folder are on the Windows DVD.

#23 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Thursday, July 22 2010 10:20 AM by Sam

I built my autounattend.xml with WSIM and copied it at the root of a UFD. In the answer file, I tell the setup to create a partition 1 on disk 0 and to accept the EULA. The language settings in the WINPE pass works but it seems to ignore the disk configuration part. Any help will be really appreciated.

Thanks

Sam

#24 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

Friday, July 30 2010 10:53 AM by Paul Matthews

I've read through your document, and followed your steps on my Windows Server 2008 R2 64bit, and have tried many times to get this to work on my VM I have created.

I started of with lots of changes that would be done during sysprep and that didn't work, so I've narrowed it down to just providing the product key in "WindowsPE" section, and setting the administrators password in "OOBE" section. Still no joy.

What seems to happen is that it says it installs all the drivers, then it states it is starting the PC for the first time. After this, it says it needs to restart the pc. It shuts down the vm pc, and I have to turn it back on again. When it boots back up it says again that it is starting the PC for the first time, then needs to restart the pc and turns the VM off again. I cannot get it out of this cycle. Anyone else had this problem and how did you solve it?

#25 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

July 11, 2010 12:36 AM by How to Build a Sysprep Answer File for Imaging

Note: This post discusses Sysprep as it pertains to Windows 2000, Windows XP, and Windows Server 2003. If you’re working with a newer version of Windows, check out these posts: Windows Vista and Windows Server 2008 Windows 7 and Windows Server 2008 R2

#26 re: How to Sysprep in Windows Server 2008 R2 and Windows 7

July 11, 2010 1:06 AM by How to Sysprep in Windows 2008 : Brian Desmond's Blog

Pingback from How to Sysprep in Windows 2008 : Brian Desmond's Blog

Leave a comment