posted @ Friday, May 07, 2010 7:01 PM

As a follow up to my Windows 7 unattended installation post, here is an example of how to install Windows Server 2008 R2 using unattend.xml.

The basic answer file settings are the same, except the server version has Roles to install. Roles are mapped to packages and specified under <servicing><package> tags. To me, the most important Roles are Hyper-V and IIS with ASP.NET, so my example answer file installs these packages.

Note: ASP.NET Role Service of IIS has several dependencies. If you just Enable it at the IIS-ApplicationDevelopment level in System Image Manager, you will get the following validation error:

Windows Feature is enabled but one or more of its dependencies have not been enabled in the answer file. Packages/Foundation/amd64_Microsoft-Windows-Foundation-Package_6.1.7600.16385__31bf3856ad364e35_/IIS-WebServerRole/IIS-WebServer/IIS-ApplicationDevelopment/IIS-ASPNET

ASP.NET has dependencies on:

IIS-ISAPIExtensions
IIS-ISAPIFilter
IIS-NetFxExtensibility

packages. IIS-ASPNET should be selected under these as shown on the picture.

IIS-ASPNET in System Image Manager

 ASP.NET also needs .NET Framework, which is installed by NetFx3 Role/package.

How to include custom drivers.

Server OS installation frequently needs drivers that not included in the standard OS image. For example, a RAID controller is not recognized without an external driver. Fortunatelly, there are two places in an answer file to specify the location(s) for both setup and installed OS drivers.

1. To specify driver for setup, include <PathAndCredentials> tag under Microsoft-Windows-PnpCustomizationsWinPE component. There can be multiple such tags with different wcm:keyValue attributes.

<component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!-- Custom drivers for setup. -->
    <!-- Put RAID or Network driver package in the directory pointed by <Path>. -->
    <DriverPaths>
        <PathAndCredentials wcm:action="add" wcm:keyValue="Path1">
            <Path>C:\Drivers</Path>
        </PathAndCredentials>
    </DriverPaths>
</component>

2. To specify drivers for installed OS image, use the same tag, but under Microsoft-Windows-PnpCustomizationsNonWinPE component.

<component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35"  language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!-- Custom drivers for the installed OS image. -->
    <DriverPaths>
        <PathAndCredentials wcm:action="add" wcm:keyValue="Path1">
            <Path>C:\Drivers</Path>
        </PathAndCredentials>
    </DriverPaths>
</component>

One point to keep in mind - if the storage controller is not recognized by setup and, consequently, the setup does not see and hard drives, the plugged in USB key containing the answer file will be assigned Disk 0. This means it will be visible to setup under letter C:. Examples above store drivers on the same USB key that contains the answer file, under \Drivers directory.

Specify OS image for installation (Full or Core).

Several Windows Server 2008 R2 editions include two installation options: Full (with GUI) and Core (no GUI, just command-line). Both of these images are contained on the installation media, in \sources\install.wim file. If installation type is not specified, setup will throw a dialog.

You can list images in any .wim file with "imagex /info install.wim" command included in WAIK. However, a quicker way to find the image name is look at Catalog .clg file names in the \sources directory. They will have the image name appended after the "_" character. For example, on Server Enterprise media, there are the following catalog files:

Windows Image Catalog files

Therefore, the two Windows images available for installation are:

  1. Windows Server 2008 R2 SERVERENTERPRISE.
  2. Windows Server 2008 R2 SERVERENTERPRISECORE.

The needed Windows image can be specified in an answer file under Microsoft-Windows-Setup | ImageInstall | OSImage | InstallFrom | MetaData location. The <Key> tag of the Metadata should be /IMAGE/NAME, and the <Value> tag contains the image name. For example:

<settings pass="windowsPE">
    <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <ImageInstall>
            <OSImage>
                <InstallFrom>
                <!-- Specify image to install.
                For Server Core installation, the Value is "Windows Server 2008 R2 SERVERENTERPRISECORE" -->
                    <MetaData wcm:action="add">
                        <Value>Windows Server 2008 R2 SERVERENTERPRISE</Value>
                        <Key>/IMAGE/NAME</Key>
                    </MetaData>
                </InstallFrom>
            </OSImage>
        </ImageInstall>

Disable opening of Server Manager at Logon.

If you don't want the Server Manager GUI to appear on first logon, there is a specialize pass setting for that:

<component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <DoNotOpenServerManagerAtLogon>true
    </DoNotOpenServerManagerAtLogon>
</component>

Disable Initial Configuration Tasks at Logon.

This specialize pass setting will not open Initial Configuration Tasks:

<component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <DoNotOpenInitialConfigurationTasksAtLogon>true
    </DoNotOpenInitialConfigurationTasksAtLogon>
</component>

Disable Internet Explorer Enhanced Security Configuration (ESC).

There is a specialize pass setting to disable IE ESC (removing the annoying need to add every Internet site to Trusted Sites). The setting is different for Administrators and regular users.

<component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <IEHardenAdmin>false</IEHardenAdmin>
    <IEHardenUser>false</IEHardenUser>
</component>

Join computer to a domain.

It is possible to automatically join the computer to a domain. Here is the specialize pass setting to join the computer to a sample "fabrikam" domain:

<component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Identification>
        <Credentials>
            <Domain>fabrikam</Domain>
            <!-- Specify user and password of the account that will join the computer to the domain. -->
            <Password>password (change!)</Password>
            <Username>user (change!)</Username>
        </Credentials>
        <JoinDomain>fabrikam.com</JoinDomain>
    </Identification>
</component>

Sample answer file.

Here is a sample unattend.xml file for Windows Server 2008 R2 Enterprise Full installation type. It includes the customizations above plus the following:

  • QuickEdit mode for cmd.exe.
  • File extensions shown in Windows Explorer.
  • Run command shown on the Start menu.
  • Administrative Tools shown on the Start menu.
  • cmd.exe pinned to Taskbar (Taskbar link).
  • Auto-logon (once) of Administrator.

(note: these will only work for the Administrator account, because it logs in first).

Roles installed: Hyper-V, IIS with ASP.NET.

Features installed:

    Role Administration Tools

        Hyper-V Tools

        Web Server (IIS) Tools  

    .NET Framework 3.5.1.

Important! The answer file will format Disk 1 and install the OS there. Please make sure this is the location you want to install to. Disk 1 will be the first storage controller disk if the storage controller requires a custom driver (i.e. it is not visible to the standard OS image).

You will also need to specify Administrator password in the appropriate (commented) places.

Download Autounattend.xml.

 

 

Copyright © Sergey Vasilevskiy