How to Sysprep in Windows Server 2008 R2 and Windows 7

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 Vista/2008, you'll find thatit's nothing like what you're used to on Windows 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:

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: http://technet.microsoft.com/en-us/library/dd744580(WS.10).aspx. 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 – 2003 is that the unattend.xml file isn't deleted at the conclusion of the Sysprep process. Recall that 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 | 6 Comments
Filed under: 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?

Leave a comment