Updated for Hyper-V RTM

Thus far we covered the steps necessary to capture a system image with Hyper-V installed, and how to install Windows and Hyper-V at the same time without dealing with system images at all.

Let's take a step back and talk about system images again.  Images are a great way to deploy a customized version of Windows to many different workstations or servers without having to go through the effort of configuring each system independently of each other.

Even if you're just setting Windows Vista or Windows Server 2008 up from a DVD, you're still using an image to do the installation.  If you look on the DVD in the \sources folder, you'll find a file called install.wim.  WIM stands for Windows IMage, and it's an actual image of a real Windows installation that Setup applies directly to your hard drive (and then manipulates a bit, but that's a different story).

You can also make your own WIM files using the imagex.exe tool that ships with the Windows AIK, which I'll link to again. 

The cool thing about WIMs (and there are actually many, but I'm just going to stick with the one that's relevant to this post) is that - using imagex.exe - you can mount a WIM as a folder on your Win6 (that's Vista and Server 2008)-based system and copy files to or from it, then save your changes.

So what does this have to do with Hyper-V installation?

Well, hang on...  there's more that we need to talk about.

With Windows Vista and Windows Server 2008, some really cool work was done to make the operating systems more servicable.  I'm not really in a position to go into all the details, but one of the absolute coolest side effects was the ability to service a Windows installation without actually booting it, which is called Offline Servicing. 

No, really... what does this have to do with Hyper-V installation?

Hyper-V RTM ships as a hotfix, which means that you can use the Offline Servicing features of the servicing stack to integrate it with any Windows Server 2008 image that you've got.  (This includes the retail media, as well as any image that you made yourself.  For best results, you should only use images that have been sysprep'd, or are otherwise generalized.)

Assuming you're using WIMs, here's how to do it.

(Robert Larson has posted a great step-by-step article that even has pictures, if that’s more your thing.  Check it out over here.)

  1. Download the Hyper-V RTM hotfix (it could actually be any hotfix packaged into an MSU)
  2. Copy the WIM file you want to integrate this fix into to a place where you have read/write access.  I usually create a folder in the root of the drive called C:\image.  If you’re copying files from a DVD, remember to remove the Read-Only attribute from the WIM file, either by right-clicking on it in Explorer, choosing Properties, and un-ticking the Read Only box, or issuing the command attrib c:\image\install.wim –r.
  3. Extract the CAB file from the MSU you just downloaded, just like we talked about in Part 2.  There's also a KB article that describes the process.
  4. Open an elevated AIK Tools Command Prompt (because you've installed the AIK, right?).
  5. Create a folder to use as a mount point for your WIM (I typically use C:\mnt).
  6. Did you know that WIM files can contain more than one image?  In fact, the INSTALL.WIM file on standard Windows Server 2008 media contains six different images!  You can see all of the images in a WIM file by running imagex /info c:\image\install.wim.  For starters, let’s work on image number 1.
  7. Run:
    imagex /mountrw C:\image\install.wim 1 C:\mnt
  8. Run:
    start /w pkgmgr /ip /m:c:\extract\Windows6.0-KB950050-x64.cab /o:c:\mnt;c:\mnt\windows /s:%temp%
  9. Check the return code by running:
    echo %errorlevel%

    If it's anything but 0, there was a failure while applying the update.
  10. Run:
    imagex /unmount /commit c:\mnt
  11. If you have multiple images in your WIM that you want to patch, repeat this process – starting at step 7, and changing the “1” to whatever image number you want to patch – for each image in the WIM.

And there you have it.  The next time you apply that image, your Windows installation will have the Hyper-V RTM bits already present in the package store.  That's different than having the role enabled, though.  You'll still need to enable it (which can be automated using parts of the unattend fragments provided in Part 2), but when you do, you'll have RTM from the beginning).