windows7sysprep

Sysprep a Windows 7 Machine – Start to Finish


This is the old version, please see the new Sysprep a Windows 7 Machine – Start to Finish V2.

Note – I highly recommend creating a boot or rescue disk before starting any windows 7 technical projects. There are many tools in the market and I use Spotmau BootSuite rescue software and boot disk utility because of it’s versatile features and top notch performance.

Windows 7 Sysprep

Last Updated on 10.04.12

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

Tip. In case you want to sysprep Windows 10, you can use our step-by-step guide.

Here is a list of what you will need:

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:

Windows 7 WAIK Version 1

Step 3

Under the “Windows Image” header, right click and select new image.

Windows System Image Manager

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.

Selecting CLG File - WSIM

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.

Answer File - Unattend.xml

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: Never
RunSynchronousCommand[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-us

amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral
RegisteredOrganization: Your Company Name
RegisteredOwner: Your Name

AutoLogon
Password: Administrator Password

Enabled: true
LogonCount: 5
Username: administrator
FirstLogonCommands

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

SynchronousCommand[Order=”1″]

SynchronousCommand[Order=”2″]
OOBE
HideEULAPage: true
NetworkLocation: Home
ProtectYourPC: 1
UserAccounts

Password: Administrator Password

Action: AddListItem
Description: Local Administrator
DisplayName: Administrator
Group: Administrators
Name: Administrator

LocalAccount[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.1 environment (USB stick or CD/DVD). You can use my theITBros WinPE3.1 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!

You may also like:

Sysprep a Windows 7 Machine – Start to Finish V2 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 ...
DISM Tool – WinPE 3.1 Boot Environment This is the new tutorial for the recent release of WinPE 3.1. You can still read the old tutorial here. DISM Tool You will need the following to...
Copy Taskbar Icons Windows 7 Sysprep This is the old version, please see the new Copy Taskbar Icons Windows 7 Sysprep v2. Ok, you can thank a colleague of mine (Dinyero Johnson) for th...
Fix Corrupt Windows 7/8/10 Temporary Profile While working with Microsoft’s Windows 7/8 or Windows 10 operating systems you have noticed that sometimes when working with multiple profiles that th...
Sysprep Windows 10 Machine: Step by Step Guide In this article we will show you how to use PowerShell and Windows System Preparation Tool to prepare a highly customized, personal Windows 10 install...
Comments
  1. Posted by Long
    • Posted by Chris Gralike
      • Posted by Christopher Denny
      • Posted by James
        • Posted by rebel47
    • Posted by Eric Hermecz
    • Posted by Tim
  2. Posted by Brian Jackson
    • Posted by Eric Hermecz
  3. Posted by John
    • Posted by aerilus
  4. Posted by Brian Jackson
    • Posted by David
      • Posted by Antunes
        • Posted by One happy chappy
    • Posted by Ben
  5. Posted by Jesse
  6. Posted by Mike
  7. Posted by John
  8. Posted by Jay
    • Posted by Dennis
    • Posted by Shaun
      • Posted by Shaun
    • Posted by aerilus
  9. Posted by Kyle
  10. Posted by Bill Swallow
    • Posted by NeedHelp
    • Posted by NeedHelp
      • Posted by Holly
  11. Posted by Brian Jackson
  12. Posted by Eric
    • Posted by George
      • Posted by Joe P
        • Posted by Joe P
          • Posted by rafael serbia
  13. Posted by tal-t
  14. Posted by Marc DeSilva
    • Posted by Eric Z.
  15. Posted by Sam
    • Posted by Ralph
  16. Posted by Pieter
    • Posted by Bob O
      • Posted by Bob O
      • Posted by Bob O
      • Posted by Bob O
      • Posted by Bob O
  17. Posted by Devon
  18. Posted by Mike
    • Posted by Dash
      • Posted by Brian Jackson
    • Posted by Stretch
    • Posted by Bryant
  19. Posted by Justin
  20. Posted by Michael
  21. Posted by Juan
  22. Posted by Justin
  23. Posted by Phil
  24. Posted by Wajhi
  25. Posted by Patrick
  26. Posted by frame45
  27. Posted by Chris
  28. Posted by David
    • Posted by Robret
    • Posted by Bob
  29. Posted by Dan
  30. Posted by Rick
  31. Posted by Richard Davis
    • Posted by Vaughan
    • Posted by Dan C
    • Posted by rantyracer
    • Posted by Sean Cotter
  32. Posted by Daniel
  33. Posted by Robert
  34. Posted by Gary Wertman
  35. Posted by Christopher Denny
  36. Posted by user101
  37. Posted by Roger
  38. Posted by Clifton
  39. Posted by Steven Khieu
    • Posted by Dash
  40. Posted by ndog37
  41. Posted by Hank
  42. Posted by Thomas
  43. Posted by Rick
    • Posted by Thomas
      • Posted by rick
  44. Posted by Joe
  45. Posted by James
  46. Posted by Funkyman
  47. Posted by rantyracer
  48. Posted by Calcaterra
  49. Posted by Gene
  50. Posted by Happy
  51. Posted by Luis
    • Posted by Luis
      • Posted by Brian Jackson
  52. Posted by Luis
    • Posted by Luis
  53. Posted by Luis
    • Posted by Luis
  54. Posted by Boris
  55. Posted by David Henderson
    • Posted by Brian Jackson
  56. Posted by Mike
    • Posted by Mike
  57. Posted by Mike
  58. Posted by Alex Smith
    • Posted by sxewhodey
  59. Posted by Babs
  60. Posted by ChrisTxHouston
  61. Posted by Jonathan
  62. Posted by sxewhodey
    • Posted by sxewhodey
  63. Posted by Khat
  64. Posted by Sharon
    • Posted by Brian Jackson
    • Posted by Yuri Olinares
  65. Posted by Caleb
  66. Posted by Joe
  67. Posted by Alex 'Freedom' Haines
  68. Posted by Justin Time
  69. Posted by Antoine
  70. Posted by morry davis
  71. Posted by Francis Brooks
    • Posted by Shane Hale
  72. Posted by Joe
  73. Posted by Joe
    • Posted by mark
  74. Posted by londo342
  75. Posted by Andy
  76. Posted by JP
  77. Posted by Michael
  78. Posted by Michael
  79. Posted by Champ
  80. Posted by cthao
  81. Posted by JohnA
  82. Posted by Anders Jensen
  83. Posted by Tom Y
  84. Posted by Robert Martel
  85. Posted by Ron
  86. Posted by mark
  87. Posted by Mike
  88. Posted by IT Genre
  89. Posted by Rich F
  90. Posted by Joe Bova
  91. Posted by Joe
    • Posted by Paul
  92. Posted by Danu
  93. Posted by Michal
  94. Posted by Chris
  95. Posted by Bill
  96. Posted by Dan
  97. Posted by Priit
  98. Posted by John
  99. Posted by Mike
  100. Posted by Tim
    • Posted by darkflux
  101. Posted by Paul Barrette
  102. Posted by Tim
  103. Posted by Matt Pickles
  104. Posted by Trevor
  105. Posted by EricZ
  106. Posted by Garvie
  107. Posted by Duke
  108. Posted by Sean
  109. Posted by emin cetinsoy
  110. Posted by jessica
  111. Posted by T800
  112. Posted by Meff
  113. Posted by kevin
  114. Posted by Mrockwell
  115. Posted by Rick
  116. Posted by Matt
    • Posted by Brian Jackson
      • Posted by Matthew Galiano
        • Posted by Matthew Galiano
          • Posted by Brian Jackson
          • Posted by Matthew Galiano
          • Posted by Matthew Galiano
  117. Posted by Darren J Taylor
  118. Posted by David Brumbaugh
    • Posted by Brian Jackson
  119. Posted by Upendra Gandhi
    • Posted by darkflux
      • Posted by Upendra Gandhi
        • Posted by darkflux
          • Posted by Brian Jackson
          • Posted by Brian Jackson
  120. Posted by darkflux
    • Posted by Brian Jackson
  121. Posted by PinYoProductions
    • Posted by Tommy Meyn
  122. Posted by CenterThinker
    • Posted by Brian Jackson
      • Posted by CenterThinker
  123. Posted by Franklyn Arnett
    • Posted by Fid
    • Posted by Sal Monella
  124. Posted by Emanuele Missud
    • Posted by Alex G
      • Posted by Emanuele Missud
        • Posted by Alex G
          • Posted by Emanuele Missud
          • Posted by Alex G
          • Posted by Emanuele Missud
  125. Posted by Emanuele Missud
  126. Posted by Firekeeper
  127. Posted by steve
  128. Posted by bob
  129. Posted by Διονύσης
  130. Posted by Tayyib Ahsan
  131. Posted by GrizzlTooth
  132. Posted by Jonathan Schaumloeffel
  133. Posted by Ishmal Jutt

Add Your Comment