Sysprep Windows 7

In this guide I will be explaining step by step tutorial on how to Sysprep your Windows 7 machine. This IT tutorial is broken down into the following sections:

  1. Audit Mode
  2. Building of the file in the sysprepfile.xml WSIM
  3. Copying of the default profile using the command “CopyProfile = true”
  4. Prompting for the computer name
  5. Enabling the Administrator Account
  6. Logging in with the Administrator for the First Time Automatically.
  7. Using CScript to Automatically activate Windows.
  8. successfully Copying the taskbar icons.
  9. After completion of the re-image process, deleting the file sysprepfile.xml.

Now before I start, make sure you have following things:

  1. The Latest version of WAIK
  2. Windows 7 machine (of course) so that you can build the XML file on that.
  3. An ISO file or a DVD of the Windows 7 installation.
  4. WinPE Boot environment.

Okay, so now that you have everything, let’s start with the process of building the unattended.xml file. dolor sit

Step 1

You will first need the Windows 7 installation DVD inserted in your DVD drive. Or if you have an ISO file of the Windows 7 installation please load it up using tools like Daemon Tools. And extract the ISO file on to your hard disk, using any extractor.

Step 2

Now, launch the WAIK, the Windows System Image Manager, and the screenshot below shows how your screen should look like.

Step 3

Opening the WAIK, you will find under the Windows Image header, the option “Select a windows image or catalog file” click on this.

Step 4

Now browse to where you have placed your ISO file. Open it up and then find the file .clg file of your windows version. The screen shot below shows that file selected. You can either select the .cfg file or you can select the install.wim file. Both will have the same effect.

Step 5

You will have to create a new XML file. Click on the File menu option then click on “Create New Answer File”. Now once you have created the file simply go to the File menu again and click on the “Save Answer File” and give your xml file a name, I gave it sysprepfile.xml. Once you create this file, you will have 2 categories, one will be Components and the other will be Packages. In the Components folder you will get the following options

1)       windowsPE

2)       offlineServicing

3)       Generalize

4)       Specialize

5)      auditSystem

6)      auditUser

7)      oobeSystem

Step 6

The following steps should be closely followed and no mistake should be made as these are critical steps. It is here, that the sysprefile.xml will be sequenced. You will have to add Components in the “Widows Image” section on the left hand side to the passes in the Answer File. Add a component by right clicking them and clicking on the “add to # pass” button. You can add many options but beware, that these have be added I certain order, or your sysprep will fail.


Step 7

Now save your updated sysprep.xml file.

Step 8

To prompt for a computer name during sysprep you will have to modify your syspre.xml file. A line needs to be removed. Please remove the highlighted line.

Step 9

Now go on and install the Windows 7 on your machine either through a DVD or an image on your USB. Once the installation is complete and you reach the welcome screen, please press CTRL+SHIFT+F3, this will reboot the system and take it into audit mode.

Step 10

Once the system is rebooted, the system will automatically log you in the Administrator account. A sysprep UI box will appear you can close it and continue with customizing your profile.

Step 11

Do any installation and any customization to your profile, the system may ask for a reboot in between, so do it and the system will take you back to the administrator account. You will be in this mode until you run the /oobe parameter. After executing this parameter, the system will do an auto cleanup of the Administrator account. By setting the copyprofile=true the system will copy the default Administrator account before its deleted.

Step 12

On the machine that sysprep is going to run on, create a folder named Scripts and in the directory “%WINDIR%\Setup\”. Now create a command file, a CMD file that is, in the folder “%WINDIR%\Setup\Scripts”. Now create a new text file name SetupComplete.txt. Modify the file and remove the .txt extension and add the .cmd extension.               Now you will have a file named SetupComplete.cmd, this is the file windows will read when it is booted up for the first time from sysprep. A script needs to be inserted in the cmd file. Insert this script “del /Q /F c:\windows\system32\sysprep\sysprepfile.xml” in the cmd file and save it. This is the script that will remove your sysprepfile.xml after its use is complete. This file is also copied to the Panther directory so add another line “del /Q /F c:\windows\panther\sysprepfile.xml”. Now save and close the file.

Step 13

Once everything has been configured correctly, copy your sysprepfile.xml file to the following folder


Now go to this sysprep folder and right click holding down shift and select the “Open New Command Windows Here” option. Now enter the following command

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

Step 14

Now after rebooting the system, open the WINPE 3.0 environments using anything, like a DVD or USB stick. Capture the image and save it to a network location.

Step 15

After reboot, Windows will and /oobe is intended to run. As long you had copied your CD Key in the sysprepfile.xml the windows will be automatically activated in the background. Also the sysprepfile.xml will be automatically deleted because of the CMD file you created, and the Administrator account will be automatically deleted as well.

There you go, the installation is complete and your system has been syspreped.  I hope this guide will help you with syspreping your windows 7 machine and if you have any questions, comments or concerns on this or any other IT tutorial, then let me know by leaving a comment!