Sysprep a Windows 7 Machine – Start to Finish

THIS IS OLD, PLEASE SEE NEW VERSION 2, CLICK HERE

This is a step by step guide on Sysprepping (and yes, I have made sysprepping a verb now) a Windows 7 machine from start to finish. This will guide you through building the unattended XML file, having the administrator profile copy over to default profile, and fixes for what is right now a not 100% working system from Microsoft. This is something I would have easily paid for when first starting this process. I don’t know why Microsoft can’t hand us a 100% working process. There will always be fixes, even with the RTM release.

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

Once you have WAIK installed on a machine your Start Menu should look like the image below:

Windows 7 WAIK Version 1

Windows 7 WAIK Version 1

Go ahead and launch the Windows System Image Manager. Picture of the program is below.

Windows System Image Manager

Windows System Image Manager

We now need to open a Windows 7 image. If you have an 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). Back in Windows System Image Manager (WISM) go to the file menu and select “Select Windows Image”. 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.

Selecting CLG File - WSIM

Selecting CLG File - WSIM

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. 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

These are very important as these are the steps in which the 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.

Download my Windows 7 x86 Sysprep XML File
Download my Windows 7 x64 Sysprep XML File

WSIM Passes

WSIM Passes

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_neutral

Set 1 for SkipRearm to allow up to 8 rearms

4 Specialize

amd64_Microsoft-Windows-Security-SPP-UX_neutral

SkipAutoActivation: true

amd64_Microsoft-Windows-Shell-Setup_neutral

Computer Name: * (Randomly generated name, use this to test)
CopyProfile: false (doesn’t quite work, we will do that manually later)
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

5 AuditSystem

Nothing required in my example.

6 AuditUser

Nothing required in my example.

7 OobeSystem

amd64_Microsoft-Windows-International-Core_neutral

InputLocale: en-us
SystemLocale: en-us
UILanguage: en-us
UserLocale: en-us

amd64_Microsoft-Windows-Shell-Setup_neutral

RegisteredOrganization: YourCompanyName
RegisteredOwner: YourName

Under amd64_Microsoft-Windows-Shell-Setup_neutral component, you will have a subheader for OOBE:

HideEULAPage true
NetworkLocation: Home
ProtectYourPC: 1

Under amd64_Microsoft-Windows-Shell-Setup_neutral component, you will have a subheader for UserAccounts:

You will want to add both an administrator password and another local account with administrator rights and password.

If you have questions, look at my image above to see full layout of components, it should help. Also, you might have additional component headings that I didn’t mention. If you are simply testing first time, just delete them for now. You can add all sorts of components later on, you should do a successful sysprep if this is your first time, better to keep it simple and to the basics.

K, now go ahead and save your answer file. The building of the XML file is now done. That is the worst part. You would think that the sysprep process would get easier as new OS’s come out, but its pretty much the exact opposite.

Prepping your machine

K, now it is time to get your machine that you want to sysprep and capture an image of ready to go. First, you are going enable the administrator account on the computer. To do this on Windows Vista or Windows 7, open up a command prompt (Run as Administrator) and input the following command:

net user administrator /active:yes

Hit enter and you should see “successfully enabled Administrator Account”.

So you should currently have two accounts on your computer. The account you are currently logged into and the Administrator account which you just enabled. You are going to want to customize all of your preferences, favorites, bookmarks, taskbar, etc. under the currently logged in account. Once you have everything just perfect, you are going to reboot the computer and login to the administrator account. This next part is very important. You are going to go to “My Computer” and then to Organize and folder and search options. Go ahead and select “Show hidden files, folders, and drives”. Picture is below.

Show Hidden Files, Folders, and Drives

Show Hidden Files, Folders, and Drives


No go to “My Computer” and you are going to rename the Default folder to Default.bak (The CopyProfile setting in Sysprep on Windows7 does not seem to work yet). Next, copy your other user account, the one you customized everything in, right click on it and select copy. Then paste within that same window. It is going to come out as USERNAME – COPY. Now rename this copied folder to Default. Now after you sysprep your computer it will create all new accounts from that default profile folder using all your customized options.

The last thing we need to do is disable the WMP sharing service. This is a bug in Windows 7 and hopefully will eventually be fixed. If you don’t disable this before the sysprep your sysprep will simply fail to run. Go to run, msconfig, and then disable the “Windows Media Player Networking Sharing” service.

Now you are ready to sysprep your computer and capture an image of it!! Finally! So, grab that XML file you created earlier and you are going to place it on the machine you built your image on. Copy or move it 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:NAMEOFYOURANSWERFILE.xml

Your computer will now run the sysprep process, removing SID, etc, and then shutdown. You can have it restart, but shutdown is always safer if you have a ton of things going on. You will need to boot to your WinPE Boot environment when your computer starts back up. If you miss the first time upon boot up, you will have to re-input your sysprep commands. So do a shutdown, not a restart.

You can use my BrianLeeJackson WinPE3.0 BootLoader to boot up from USB or CD and capture your image. Once you capture your image, you are all done. You now have a sysprepped Windows 7 image. I have performed this task on over 120 computers so far and it has been flawless. The hard part was getting everything configured correctly. I hope this documentation helps someone out there, I know I would have killed for a tutorial like this when I first started :)

  • greg mccarthy

    Hi,

    Im having the same issue as Joe, Andrew Fichera and Ricky,

    I have just been building my image about to sysprep and removed my machine from the domain, which prompts for a restart obviously, once restarted get the

    “…Windows could not complete the installation. To install Windows on this computer, restart the installation.”

    error.

    Does anyone have any clues on what the issues are here or a fix.

    Cheers

  • Albert

    Hello Greg,

    I think your problem is on the Integrated peripherals in CMOS SETUP Utility. In Sata mode change AHCI to Native IDE.

    Check it

  • http://www.lwcomputing.com Lee

    Re:
    “…Windows could not complete the installation. To install Windows on this computer, restart the installation.”

    You may be able to work around this… when you get this error DO NOT click ok or dismiss the message. Instead, press Shift-F10 and then in the command prompt that comes up, type CD\WINDOWS\SYSTEM32\OOBE
    then type MSOOBE
    That should launch the final setup. Complete it and once it’s done, allow the machine to reboot. You should be good now.

    Would love to know WHY this happens but as yet, I do not.

  • http://www.yahoo.com spidey2010

    I prepare the image for Windows 7 enterprise edition 64 bit.
    After I sysprep (sysprep /generalize /oobe /shutdown /unattend:win7ent64bit.xml

    I had problem saying “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] ”

    As mentioned here:
    http://support.microsoft.com/kb/934308

    but the kb link above does not provide a definite solution for this….

    I did disable Windows “Media Player Networking Sharing” service from msconfig.
    After that it restarted and had the same problem with greg mccarthy and followed what Lee suggested.

    After that it gave me just a black screen…. so I turned it off and turn on the machine and the setup completed…

    Does anyone have a solution for this?
    I need to deply windows 7 Enterprise 64bit….

  • http://www.yahoo.com spidey2010

    Hi, I remove the oobe from my unattend.xml and I did not face the same error message again…..
    WHat could be the reason behind this????
    can anyone tell me? thanks a lot

  • Jon

    Lee,
    The MSOOBE workaround worked for me, but that ignored my unattend file. Any idea how to prompt it to complete the setup using unattend?

    -I sysprepped and pulled an image, then rebooted. The OOBE used the unattend without problems, and I was able to join the domain and do whatever I wanted with the system.

    -I then applied the previously created WIM, which is when the error and reboot loop popped up.

  • Tim

    Lee, your steps worked when countless others did not. Thank you so much!

  • Park

    Hi
    im need to move profileuser windows7 for C:\Users => D:\user
    please help me
    park,

  • http://www.kitchen-towels.net Kitchen Towels ·

    sometimes windows7 won’t install if you install it on a pc with a previous installation of windows XP ”

  • devli n7

    Hi. Firstly, thank you for the post it is very very helpful.

    So now if I load Windows 7 on a machine by installing from DVD. When I get to the mini-setup screen I press SHIFT+CTRL+F3 to go into audit mode. I add my drivers etc and then when ready I run a sysprep pointing at my unattended.xml file, I generalize and oobe it. When the machine restarts it still prompts me for a computer name even though I have an entry in spelialize – shellsetup_neutral. I have set the computer name to * which apparently sets a random name. I have also tried user %compname%. I have also tried setting it to a fixed name like “ITCOMP”
    If I press enter on the computername the rest of the installation is completely automated. I would just like it to stop prompting for the computername.

    The computer name is preset as “PC” but appears to be what ever is set in the COMPUTERNAME field in the mini-setup before I hit CTRL-SHIFT+F3 to switch to audit mode.It isn’t a big issue, it just means I need to press enter once on each of the 400 machines but I would like to sort it out to save me running around :-)

    I have tried googling this but all I have found is people with the opposite problem where they aren’t prompted to change the computername.

    Any ideas?

  • http://www.christowles.com Chris Towles

    Have having problems my self I hope this will help others avoid the problems I had.

    Windows
    7 and Windows Server 2008 and using Sysprep

  • Chris

    thanks so much for this tutorial. I’ve been searching the Internet for many many hours trying to figure out exactly what to configure under what area. You’ve saved me days of work i believe.

    Thank you greatly

  • Robert

    Hi Everyone,

    If you’ve been trying to get copyprofile to work for as long as I have, you may be getting to the point where you realize that Microsoft has screwed us over. I believe the reason they don’t want to make a simple Default User which includes all your settings is that they can’t eliminate the possibility that license agreements could be avoided by your multiple users. Even though it is our responsibility to maintain our license compliance, and not Microsoft’s, they are committed to doing everything they can to frustrate this possibility.

    In the mean time, does anyone here know if there is a comprehensive list of the functions incorporated in the Windows System Image Manager – Components ?

    I have searched and searched, and I can’t seem to find anything. I need to be able to look up a function that I want to include in my sysprep unattend answer file and then know which component to add and which pass to add it to.

    Please help if you can,

    thanks,

    Rob

  • Pingback: Where can I find a beginner’s guide to using sysprep for deploying Windows 7? Drija

  • http://www.audioswitch.info Nevaeh Green

    well, i have troubles installing windows7 on my PC. maybe i need a bios update or something ;-*

  • emJay

    while i Sysprep Vista i had the issue of skipping unattended.xml

    it was fixed by providing

    sysprep /generalize /oobe /shutdown /unattend:C:\FULLPATH\win7ent64bit.xml

  • Bernie

    Thank you very much for this documentation, Lee.

    I am getting the prompt to enter a username and password.
    Is it possible to skip this prompts?
    Thank you.

  • j27albury

    AGREED WITH DEVIL N7. Just trying to get rid of the computer name request. ANY IDEAS?

  • http://www.chipdisk.com Corey Williams

    When I run sysprep the computer prompts me to create a user account. I would like to bypass this option.

    The second thing is that the cscript isn’t working. The unattend.xml files are still on my computer after the sysprep runs. Why?

    Thanks,
    God Bless.

  • Johnny99

    Hi,

    I would like to add all the driver models within the image and adding them with the image so I can have the dvd of it and install it on every model and it will find its driver and install it on that model. I want to do this for windows 7. Everyone is talking about mdt, I used to do this in sysprep.inf previously where I would specify the path for the drivers, is it possible for windows 7?

  • Johnny99

    Can we add the driver paths into unattend.xml file?

  • rebel47

    in case anyone is wondering, you can also add the driver paths directly into the registry a la sysprep on XP. navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and on the right pane edit the DevicePath value to include your driver paths, separating each with a semicolon. just be sure to leave in %SystemRoot%\inf

  • rbbell

    Hey Lee,

    your steps also worked for me.
    The Shift+F10 hint sent my nightmares away ;-)

    Big up!

    Thanks
    Maik

  • WDSGuy

    Johnny99,

    Use DISM.exe to inject drivers into your .WIM image after capturing. This can be done afterwords.

    Mouting and Injecting Drivers for x86 (32-bit)
    ==============================================

    DISM.exe /Mount-Wim /WimFile:E:\ISO\Win7x86\install_dell.wim /index:4 /MountDir:E:\temp

    DISM.exe /Image:E:\temp\ /Get-Drivers

    DISM.exe /Image:E:\temp\ /Add-Driver:C:\Drivers /recurse

    DISM.exe /Image:E:\temp\ /Get-Drivers

    DISM.exe /Unmount-Wim /MountDir:E:\temp\ /commit

    Unmounting (Discard Changes)
    ============================

    DISM.exe /Unmount-Wim /MountDir:E:\temp\ /discard

    Driver Notes
    ============

    Make sure driver packages are stored in C:\Drivers. Extract and save your drivers to C:\Drivers

    You may need to “Expand” the driver packages if they fail. Eg. “expand *.* \expand”. This is critical for injecting NVIDIA chipset drivers.

    Driver injecting for x64 (64-bit)
    ================================

    DISM.exe /Mount-Wim /WimFile:E:\ISO\Win7x64\Windows7x64.wim /index:1 /MountDir:E:\temp

    DISM.exe /Image:E:\temp\ /Add-Driver:E:\Drivers\DELLe6520\E6520-win7-A00-R297534\E6520\win7\x64 /recurse /ForceUnsigned

  • morry davis

    I enjoyed the article, will enjoy it even more if it works, capturing the image now. I did have a question though I have to configure a bunch of laptops and all of the instructions I see say you need the DVD media for Windows, all the laptops we buy today don’t come with DVD media so how do you get around this?

  • Neil Roberts

    I have an issue during capture. All the sysprep instructions are basically straight forward for my Windows 7 machine but when i pxe boot to my server and boot to capture my image, my “volume to capture” is showing as D: it seems as if after sysprep my c: drive has changed to my d: and my c: drive is now showing as the hidden system reserved drive. Any ideas????????????

  • http://citalopram20mg.net Lenny Kirklin

    I real delighted to find this web site on bing, just what I was searching for : D too saved to my bookmarks .

  • melbatista

    THANKKKKKKKKKKK YOU!!! IT WORKSSS PERFECT! I REALLY APRECIATE THIS! DOUBLE A+ my friend! People like you make the Internet Better! Take Care!. M. Batista (MCSA, A+).

  • http://rygospo.free.fr/member.php?u=253316 Carmel Willick

    Many thanks for the helpful tips. You learn about something each and every day.

  • Pingback: Where can I find a beginner’s guide to using sysprep for deploying Windows 7? - Admins Goodies

  • http://flavblog.com/tag/farm/ John McTavish

    I was wondering if you ever considered changing the structure of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?

  • scott Milch

    Great Blog . How Can I accomplish this with a Brand New OEM Machine ??? And No win 7 Media

  • Ian

    This site has been invaluable to me with my Windows 7 Sysprep and WinPE needs. Thank you!

  • http://www.brianleejackson.com Brian Jackson

    Glad I could help!