How to SYSPREP Windows 7

We will begin with the required files. As you go through the article it will be more clear. The files required for you to complete the process:

Windows  Automated Installation Kit

This will be installed on a computer that is not being used for imaging in order to create an unattend.xml file for sysprep and the image.wim file located on the Windows 7 installation disk. Download WAIK


Download here. Now install Windows 7 on a computer  and use the domain account, this domain account must have local administrator privileges and be added to the Administrator’s Group. It must not have any scripts/policies pushed to it. In this guide, we use the domain account named, imageprep as we install the software from the DFS Share. This will allow repairing of the programs if needed by finding the setup  files. You can also use a local account if you wish. I would install all the required programs, configure settings, start menu, create local user accounts and configure the profile. This profile will later be our default profile on the computer in image.

Once it is ready, you will need to create the unattend.xml answer file by using Windows System Image Manager (Windows SIM). On another computer install the WAIK – when it has finished installing run Windows SIM from start menu.

  1. Now insert the media that you used to install W7 on the image computer.
  2. Run Windows SIM from Start Menu by selecting Tools -> Create Catalog.
  3. You will be prompted for the “install.wim” which is located on your media.
  4. Browse to this file in the sources directory on your W7 media – when the catalog is complete, you will be ready to configure your answer file.
  5. A sample unattend.xml file is attached for your reference. Open this file, and have a look at the settings configured.
  6. Download unattend.xml

Now we need sysprep to prompt us for a computer-name before it is added to the domain. The problem i found with the unattend.xml file and sysprep was that if the computer-name is not specified in the file, then it will add the computer with a random name to the domain. If you remove <ComputerName></ComputerName> from the answer file, it will prompt you for a name when the answer file is processed but by then it is too late. The computer will haveb een added to the domain already, using the random name and if you name the system after this, then it will cause more problems usually trust relatonship errors. The work around here for this was to use an altered version name mysysprep.exe, instead of Windows sysprep.exe file. Mysysprep2 will allow you to name the computer and add it to the domain after unattend.xml file has been processed. Mysysprep must be placed in C:\Windows\System32\Sysprep alongside sysprep.exe. Do not remove or rename the sysprep.exe file.

In the attached unattend.xml file, you will see

<ComputerName>%Please input a computer name(0,15)%</ComputerName>
<JoinDomain>%Please select a domain to join{}%</JoinDomain>

These are the specific entries when mysysprep2 is being used. You may get errors in SIM but these should be ignored. The (0,15) will truncate the name of the computer if it is longer than 15 characters.


This tell the sysprep to copy the configured profile to the default profile

OU must be specficied to add the computers, otherwise it will add them to the domain.

With the unattend.xml file, you will need to create a local user account  during the sysprep process, when you install Windows 7 using the disks, you’ll be prompted to create a local user account. This process will still occur with attend.xml and sysprep. So you should have the local user in the answer file, in our answer file we create a user named TempUser. This user gets deleted when the laptop first boots up to the Windows Logon Screen. The purpose of this is to hide the prompt to create a local user after sysprep runs.

A trick herewhich is to browse to C:\Windows\Steup directory, and create a new directory called scripts. Inside the scripts dir, create a file called SetupComplete.cmd, commands that you place in SetupComplete.cmd will run before the windows logon screen and here is where the TempUser will be deleted.

To delete the user, create the follow command in SetupComplete.cmd

Delete Temp User
net user TempUser /delete

To enable the administrator account use:

net user Administrator /active:yes
This needs to be done, because the sysprep will disable the administrator accounts.

Delete unattend.xml file

del C:\Windows\System32\Sysprep\unattend.xml
To be on the safer side with passwords, even though they are encrypted

You should customize your answer file depending on your requirements. So, after completing the unattend.xml file, copy it to the C:\windows\system32\sysprep -> this should get you started to run sysprep on the comp.

From a configured profile, open command prompt and run the following command to start the sysprep process.

mysysprep.exe \generalize \oobe \shutdown \unattend:unattend.xml

The computer will shut down after finishing sysprep.

You can now take the image of the hard drive, depending on your chose methods but we use Ghost, as it will take the image of the whole drive.  ImageX didn’t work for me, because with ImageX you cannot take a disk image, and have to do each partition individually and the same is for applying image, where as, Ghost allows you to have the complete image. When the image is applied, to the computer it will restart, and you will prompt for a comp-name, then the dom-name, which will automatically appear as specified in

<JoinDomain>%Please select a domain to join{}%</JoinDomain>

Multiple domains can be added to produce a drop-down menu

<JoinDomain>%Please select a domain to join{domain1;domain2;domain3}%</JoinDomain>

Once the setup process is completed, and the PC booted up to the windows logon screen, you should be able to login using your domain account, if all went well.

Additional Tips / Guides

To ensure that hardware stays, after running sysprep

True = PnP devices will remain installed on the dest-comp. Devices, do not need to be installed during the specialized configuration pass. This should be added to the generalize pass: x86_Microsoft-Windows-PnpSysprep

Creating a custom power plan

You can create a custom  power plan, and specify it in the unattend.xml. You will create and name the custom power plan, this will be in Control Panel -> Power Options. After it’s done, get the GUID of your plan, to find the GUID, open  command prompt and run PowerCfg -List and look for the Guid. Add this to the unattend.xml file, and it will be the default PP. This should be added to the specialize pass: x86_Microsoft-Windows-powercpl__neutral

Disable Action Center “Set Backup” Notification

You can disable ActionCenter Notifications via the Group Policy or run the follow registry in a configured profile

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsBackup] “DisableMonitoring”=dword:00000001

Unpin Short Cuts and Add Custom Short Cuts

Download the script ->  ConfigTaskbar.vbs

Copy the script, and paste it in C:\windows\system32\sysprep\custom – Call this script via batch file by placing it in the configured profile’s startup folder, which is the default profile. After it runs the batch file will be deleted – It is only needed for the first time.

Network Location Issues

You have specified a network location in the unattend.xml file, but you still get prompted when first logging in. To resolve this, install the hotfix:

Internet Explorer Resetted

Add you IE settings to your unattend.xml file under the specialize pass:

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to SYSPREP Windows 7

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested