Networknet archive Blog

Windows 7: Deploy the operating system with Autounattend.xml

Originally published Last updated 14 comments

Deploying Windows 7 in an enterprise requires more than installing each system from DVD. An answer file supplies the settings needed during Windows Setup. The goal of an unattended installation is to complete setup without prompting for input.

What is an unattended answer file?

An "answer file" is an XML-based file that contains setting definitions and values to use during Windows Setup. In an answer file, you specify various setup options, including how to partition disks, the location of the Windows image to install, and the product key to apply. You can also specify values that apply to the Windows installation, such as the names of user accounts, display settings, and Internet Explorer Favorites. The answer file for Setup is typically called Autounattend.xml or Unattend.xml.

Answer files created in Windows System Image Manager (Windows SIM) are associated with a particular Windows image. This enables you to validate the settings in the answer file to the settings available in the Windows image. However, because any answer file can be used to install any Windows image, if there are settings in the answer file for components that do not exist in the Windows image, those settings are ignored.

I use Windows System Image Manager (SIM) to create and edit unattended answer files. Below is my sample Autounattend.xml, with basic Windows Setup settings and minimal Windows Welcome customizations.

The Autounattend.xml file contains settings for different components and configuration passes. I use the following components in this sample:

Windows PE: Component - Microsoft-Windows-Setup

Wipe the disk, create and extend a primary partition, format it and install Windows 7. Accept the Microsoft EULA and supply my full name and company.

Windows PE: Component - Microsoft-Windows-International-Core-WinPE

I specify the default language, locale and other international settings for Windows Setup. Other language options can be defined here too. I used this component to configure Dutch, German, Japanese and Chinese settings during my deployment.

Specialize: Component - Microsoft-Windows-Shell-Setup

Microsoft-Windows-Shell-Setup contains settings that control the Windows shell. I use this component to set my time zone. It can also supply the ComputerName, which I will configure later with Sysprep.

Specialize: Component - Microsoft-Windows-Deployment

A standard Windows 7 installation disables the Administrator account and prompts for the name of an administrator account. Here I enable the local Administrator account with net.exe. Additional commands can also be added to this component.

oobeSystem: Component - Microsoft-Windows-Shell-Setup

The oobeSystem pass configures the first-boot experience. I supply default settings and hide the corresponding setup steps. I also add a local Administrator account with the password password2011. Change that password if you use the sample file.

Autounattend.xml

XML95 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <DiskConfiguration>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Extend>true</Extend>
                            <Type>Primary</Type>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Label>LocalWin7HDD</Label>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
                <WillShowUI>OnError</WillShowUI>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                    <WillShowUI>OnError</WillShowUI>
                </OSImage>
            </ImageInstall>
            <UserData>
                <AcceptEula>true</AcceptEula>
                <Organization>Networknet</Organization>
                <FullName>Networknet</FullName>
            </UserData>
        </component>
        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SetupUILanguage>
            <UILanguage>en-US </UILanguage>
            </SetupUILanguage>
            <InputLocale>en-US </InputLocale>
            <SystemLocale>en-US </SystemLocale>
            <UILanguage>en-US </UILanguage>
            <UILanguageFallback>en-US </UILanguageFallback>
            <UserLocale>en-US </UserLocale>
        </component>
    </settings>
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <TimeZone>W. Europe Standard Time</TimeZone>
            <ComputerName></ComputerName>
        </component>
        <component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Description>Enable Administrator account</Description>
                    <Path>net user administrator /active:yes</Path>
                    <Order>1</Order>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <ProtectYourPC>1</ProtectYourPC>
                <NetworkLocation>Work</NetworkLocation>
                <HideEULAPage>true</HideEULAPage>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
            </OOBE>
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>cABhAHMAcwB3AG8AcgBkADIAMAAxADEAUABhAHMAcwB3AG8AcgBkAA==</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Name>administrator</Name>
                        <Group>administrators</Group>
                        <DisplayName>administrator</DisplayName>
                        <Description>Default Administrator Account</Description>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="catalog:c:/vm-backup/win7-enterprise/sources/install_windows 7 enterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

Create the Autounattend.xml answer file

  1. Open Notepad.
  2. Copy the Autounattend.xml example and paste it into Notepad.
  3. Save the file as Autounattend.xml.
  4. For VMware ESX, Microsoft Hyper-V or Oracle VirtualBox, create a virtual floppy disk and copy the file to it. For a physical system, copy the file to the root of a USB flash drive or burn it to a CD or DVD.

Use the sample as a starting point, then open it in Windows System Image Manager and edit it for your installation. Change the password and be aware that WillWipeDisk is set to true. Windows System Image Manager is part of the Windows AIK deployment tools.

Windows System Image Manager Autounattend.xml

Autounattend.xml media with the sample file

The links below provide the sample answer file and a virtual floppy disk containing it. You can download the virtual floppy disk and mount it in your virtualization environment.

I created a virtual machine on my Hyper-V server, attached Autounattend_HyperV_VirtualPC.vfd and mounted the Windows 7 ISO image. After I started the virtual machine, installation took 10 minutes. Windows 7 finished installing, and I could sign in with the default password2011 password.

  • Windows 7 Setup
  • Windows 7 Setup
  • Windows 7 Setup
  • Windows 7 Setup
  • Windows 7 Setup

References

14 comments

Comments from the original WordPress site, kept read-only.

  1. Steven

    Thanks for posting this,its good at explaining the different set ups you apply in the windows sim.
    Could you tell me how to create the .vfd file for the autounattend.xml? I would like to try booting off the virtual floppy with my own answer file.

  2. mark

    Hi

    When i try to open the .xml file using WSIM it wants to know where the catalog .clg file is?

    1. Ivan Versluis

      Hi Mark,

      I had same issue here. Please insert a Widows 7 installation disk and locate that file there. If I remember correctly it should be located in Sources folder, otherwise check with 7z compression tool the install.wim content.

      Good luck.

      -Ivan

  3. Jason

    Hi,

    I just tried your tutorial with no success. I just downloaded your file and placed it, by itself, on a USB key. I then started a Windows 7 install from a DVD and it just went right to the "Install Windows" screen, no automation. What am I doing wrong? The reference computer has nothing on it. I just want to see how this all works. The file is called "Autounattend.xml"

    Thanks

    Jason

  4. rajat

    hi
    i have multiple os images,but i want only a particular os image to be selected for installation.how do i specify setting in DISM so that it takes that os image automatically .

  5. Periyanayagam

    Hi..I need to install Windows on C drive Only without affecting other volumes on DISK 0.Is this possible??

  6. my website

    Can I simply say what a relief to uncover an individual who actually knows what they're discussing over
    the internet. You actually understand how to bring a problem to light and make it important.
    More people need to look at this and understand this side of your story.
    I was surprised you're not more popular given that you certainly have the gift.

  7. Faceparty.com

    I've been exploring for a little bit for any high quality articles or weblog posts on this sort of house
    . Exploring in Yahoo I at last stumbled upon this web site.
    Reading this information So i'm happy to show that I've an incredibly excellent uncanny
    feeling I discovered just what I needed. I most definitely will make sure to do
    not omit this site and give it a glance regularly.

  8. Reggie Philip

    Hello Ivan, 

    A question please -  Is there a way to rename the Adminstrator account to aka (abc) and log into abc (administrator) after the sysprep is complete? Basicly if thrtr id a line in the answer file where Adaminstrator can be renamed?

     

    Kind Regards