• Home  / 

Back to basics – Understanding Unattend.xml automation in Windows 7

By arwidmark / October 19, 2010

If your goal is to very quickly have a nice fully automated Windows 7 setup, including drivers, application etc. – This article is not for you. If that’s your goal, you should download the free Microsoft Deployment Toolkit (MDT) 2010, and use that as your deployment solution.

That being said, if you rather is a hardcore geek who wants to build everything yourself from scratch, instead of using the standard tools that Microsoft recommends, this article will help you create your own answer files to automate the core Windows 7 setup.

This is also your chance to challenge the 20+ people strong deployment team at Microsoft, showing them that you are better building deployment solutions than they are. Why use a standard solution that 300.000 other people on this planet are already using when you can re-invent what they have done and build it your self.

So here is the text to get in touch with your inner deployment geek…

Download the sample files:

Understanding Unattend.xml automation in Windows 7

Background info…

The core setup of Windows 7 can be automated by creating an answer file, the Unattend.xml file. The Unattend.xml for Windows 7 (and Vista/2008/2008R2) are divided into sections, or configuration passes. This is because different parts of the setup are reading settings from different passes.

This means that depending on what type of Windows 7 setup you are doing, you need to populate different sections in the answer file. The premium tool for editing the unattend.xml file is Windows System Image Manager (WSIM) from the Windows Automated Installation Kit (WAIK).

The settings that you have to define also depends on if you are using setup.exe to deploy Windows 7, or just using an image utility like ImageX (or ghost, or whatever) to apply an image. I will cover all these scenarios.

Please also notice that you need different answers files depending on what platform (x86 and x64) you are deploying. An answer file for x86 cannot be used for x64 and vice versa.

Scenario 1 – Running setup.exe to deploy Windows 7.

If you boot the default Windows 7 DVD – Setup.exe starts automatically. To have setup.exe pick up an answer file, we just need to named it AutoUnattend.xml and store it in one of the paths that setup.exe looks for answer files in. The most common location is a removable media like a USB stick.

In the sample files for this article you will find a minimal, but fully automated answer file for this scenario. The sample file is for the x86 version of Windows 7 Enterprise when using KMS for activation, joining a WORKGROUP (no Product Key specified in the answer file).

Scenario 2 – Running Imagex to deploy Windows 7.

As mentioned you don’t need to run setup.exe to deploy windows 7, you can boot into a WinPE 3.0 environment and use tools like imagex to apply an image. If you don’t use setup, you need to also create and format the drive before applying the image. The overall process is the following:

  1. Boot on WinPE 3.0
  2. Create and format a partition (C:)
  3. Use ImageX to apply a previously sysprepped image to C:\
  4. Create a bootloader
  5. Copy your unattend.xml file (named Unattend.xml) to C:\Windows\System32\Sysprep
  6. Reboot

In the sample file for this scenario, I have taken the sample file from Scenario 1 and just removed the WinPE pass settings. I could have used the exact same file, for any settings in WinPE pass are simple skipped when using ImageX, but I prefer to have as clean answer files as possible.

Scenario 3 – Running sysprep

You can also prebake the answer file into your image when running sysprep. If you do that, you don’t have to copy it in step 4 in the previous scenario.

The sample file for this scenario are the same as for scenario 2. You can have sysprep use it by either specify /unattend: when running sysprep. Or by storing the unattend.xml file (named Unattend.xml) in the C:\Windows\System32\Sysprep folder before running sysprep. The normal switches for sysprep are /oobe /generalize /shutdown (or /reboot).If we wanted we could also add settings for the Generalize pass for this scenario if we wanted. That section is being read when executing sysprep.

Notes about the answer files.

In Windows 7 the Administrator account is disabled by default. It can be enabled by either specifying the AdministratorPassword value together with Autologon settings, or like most people did in the Windows Vista timeframe, by running a few RunSynchronous Commands in the specialize pass. I selected to use the AdministratorPassword/AutoLogon feature in my samples since I wanted to Autologon anyway.

Also, if you are deploying into a workgroup, like my samples, there is a need to specify an extra account in the unattend.xml, or the Windows 7 setup will stop and prompt youfor a user. In my sample I use a neat trick. Since I have enabled the administrator account, I simply specify that user as the extra account, and I avoid the need for creating an extra user which later may have to be deleted.

/ Johan



About the author


N.A.Malik - October 22, 2010


I have checked your answer files , it helped me !!!!! Bundle of thnks.’

Here I have further questions, I hope you can ssist me with them as well.

The file for the 2nd and 3rd Scenario is for x86 and I used it , it work absolutly fine as I was trying to achive… but in you case you are using the “PASSWORD” called P@ss0rd. I dont need any password (password should be blank). I try to edit the file in WSIM and delete the Password vlue, not worked, enter an “*” but still not work. It displys the screen that user must chnge pssword now.
Can we get rid form it ? I mean pssword should be blnk.
Here i would like to mention that I changed “user name” from Administrator to “My-Laptop” and change the CopyProfile to “True”and it work fine, Can you please advise me how to solve the Password issue as I mention above ?

All i need is to user must accept the EULA and everything should be unattended and Password should be blank. Waiting for your help.

2. If i need file for the x64 , how i can chive that?

Comments are closed