Hyper-V Installation Tricks - Part 2: Unattended Installation of Windows and Hyper-V

Updated for Hyper-V RTM

Picture it:  Sicily, 1914.  You've got a bunch of Servers that you need to install and configure Windows Server 2008 and Hyper-V on.  You don't feel like messing around with Sysprep.  What do you do?

Well, since none of these things existed in 1914, you're probably pretty safe, but that doesn't really help anyone right now, does it?

What you need, is a way to do an unattended installation of Windows and Hyper-V so you don't have to sit there the whole time and type commands when the system is ready for you.  Lucky for you, we've already thought of that. 

Before you begin, I strongly recommend that you download the Windows AIK for Windows Server 2008 and Windows Vista SP1.  The AIK contains tools and documentation specifically for helping administrators just like you to roll-out Windows on a large scale.  With the AIK, you'll get a nifty little tool that will help you build unattended installation files (formerly called sysprep.inf, now called unattend.xml).  You can download it here.

Assumptions

  • For the purposes of this post, I'm going to assume that you already have an unattend.xml file you plan on using to answer questions at install-time.  In the body of this post, I'll only be providing XML fragments for you to drop into your answer file as necessary.  But, just to make sure that everyone gets the information they way, I'll attach a complete and working answer file (except for the product key, of course), which you can find at the bottom of this post. (Use that file at your own risk - it repartitions your hard drive, so don't use it unless you understand everything it does!)
  • You're dealing with enabling the Hyper-V role on x64 servers, and you want to apply the RTM patch.
  • You're going to be using a USB key with your Windows installation media to do the unattended installation.  You could just as easily create a custom install DVD with the unattend file and the RTM QFE on it.  It's up to you, but I'm just going to stick with the steps for a USB key.

The Steps

  1. Download the Hyper-V RTM patch.  (We're assuming you're doing this on the server, so we're working with x64 packages only.)  It's over on the Microsoft Download Center, which is right over here.  Download the MSU, and save it to your local machine.

  2. Create a working directory on your local machine.  I prefer to call mine C:\extract.

  3. From an elevated command prompt, run the following command:
    expand -F:* Windows6.0-KB950050-x64.msu C:\extract

  4. Look in C:\extract and you’ll see an assortment of files.  There are only two files that you need to care about.  First, take a look at Windows6.0-KB950050-x64.xml in your favorite text editor. 

    Look at the <package /> element.  We’re going to use this in a minute, so you may want to copy it to your clipboard.

  5. The next file to find is Windows6.0-KB950050-x64.cab.  This file contains the actual hotfix. Copy it to the root of your USB key.

  6. Open up your unattend.xml file and add one of the following fragments right after the <unattend /> element, but before any of the <settings /> elements.

    You’ll notice that in the fragments below, we’ve used the <package /> section that we copied out of the XML file in step 4.  The only change we made was to the <source /> element’s location attribute, so we can make sure that Windows Setup will know where to find the hotfix. 

    <!-- fragment for Server Full -->
    <servicing>
    <package
    action="configure">
    <assemblyIdentity
    name="Microsoft-Windows-Foundation-Package"
    version="6.0.6001.18000"
    processorArchitecture="amd64"
    publicKeyToken="31bf3856ad364e35"
    language="" />
    <selection
    name="Microsoft-Hyper-V"
    state="true" />
    <selection
    name="Microsoft-Hyper-V-Management-Clients"
    state="true" />
    </package>
    <package
    action="install">
    <assemblyIdentity
    name="Package_for_KB950050"
    version="6.0.1.9"
    processorArchitecture="amd64"
    publicKeyToken="31bf3856ad364e35"
    language="neutral" />
    <source
    location="E:\Windows6.0-KB949219-x64.cab" />
    </package>
    </servicing>

    -or-
    <!-- fragment for Server Core -->
    <servicing>
    <package
    action="configure">
    <assemblyIdentity
    name="Microsoft-Windows-ServerCore-Package"
    version="6.0.6001.18000"
    processorArchitecture="amd64"
    publicKeyToken="31bf3856ad364e35"
    language="" />
    <selection
    name="Microsoft-Hyper-V"
    state="true" />
    </package>
    <package
    action="install">
    <assemblyIdentity
    name="Package_for_KB950050"
    version="6.0.1.9"
    processorArchitecture="amd64"
    publicKeyToken="31bf3856ad364e35"
    language="neutral" />
    <source
    location="E:\Windows6.0-KB949219-x64.cab" />
    </package>
    </servicing>

  7. Save the unattend.xml file to your USB key as "autounattend.xml".

  8. Go test it out.  Pop a Windows installation DVD into one of your servers and plug in the USB Key that you copied all of your unattend files to.  If you had the unattend file answer all of the questions during setup, the installation should just start without you having to do anything.

  9. Once you're at the desktop of your new Windows installation, go check in the Programs applet in the Control Panel.  If you look at installed updates, you should see KB950050- the Hyper-V RTM QFE.

Server_unattend.xml