Automating “Boot from VHD” OS Installation

ws2008 r2 blog logo A few weeks ago I did a post on creating a “Dual Boot From VHD” environment.  In the past couple of days I decided to explore and test a couple of other tools.  Both tools are scripts but each took a different approach to automation.

The first script I looked at is the WIM2VHD script written by Mike Kolitz.  This is a well written and documented script.  The script prerequisites indicated the Windows Automated Installation Kit (WAIK) must be installed but you can actually run the script if only the IMAGEX.EXE and BCDBOOT.EXE programs are present.  Therefore you could easily build a lightweight WinPE disk and use this via a floppy (remember those?), CD, DVD, or USB stick.  Well, maybe not the floppy.

The next script I looked at is the InstallWindowsImage PowerShell script written by Peter Brundrett.  This is an interesting script and uses the API functions in WIMGAPI.DLL.  It also uses BCDBOOT.EXE.

I like both scripts but it’s a little disappointing when you find out neither is technically supported.  Neither is the method I captured and blogged about (using WinPE and Setup).  So out of the four methods I have discovered, only one is supported.  The supported methodology is to use the tools and techniques in the WAIK.

I would have preferred to see us do the work in setup to allow for an unattended setup method.  Maybe we’ll see that in a future release of Windows 7 and Windows Server 2008 R2.  Until then, you have lots to explore with the WAIK, the scripts above, Setup methods, MDT, SCCM, and WDS.  Got all of that?


Testing on a ThinkPad T400

Oh, and I forgot to mention how my machine is setup now.  I am considering using the Lenovo ThinkPad T400 as my road and demo machine.

The T400 is the little brother to the W500 but it’s no slouch from a performance point of view.  The video chipset is slower than my T61p, but it has a faster dual core proc and 8GB of 1067MHz DDR3 memory.  The T400 14.1” screen is super bright.  I rarely use it in torch mode.

At the moment I’m using a 186GB 7200rpm hard drive but will likely move to a 300GB drive before too long.  I’m trying to get a little more mileage out of my 200GB drives.  Anyone ever get upset a 200GB drive is really 186?

Two Operating Systems in a Partition

I installed Windows 7 the old fashioned way.  It’s installed in a single 186GB NTFS partition on the physical disk.  I wasn’t sure at the time if I was going to use this disk with Windows 7 only.

Yesterday I installed Windows Server 2008 R2 on the same partition.  However, I used the WIM2VHD script above to install R2 inside a .VHD file.  I used BCDBOOT to make the .VHD bootable which also fixes up the Boot Configuration Data (BCD) and prompts me for the desired OS at power up.

Here were the installation messages:

C:\Program Files\Windows AIK\Tools\amd64>cscript wim2vhd.wsf /wim:d:\sources\install.wim /sku:serverenterprise
/vhd:c:\WindowsR2\windowsR2.vhd /disktype:dynamic
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Windows(R) Image to Virtual Hard Disk (WIM2VHD) Converter
Copyright (C) Microsoft Corporation. All rights reserved.
Version 6.1.7100.2

Check for updates at!

        OS=Windows 7 Ultimate

INFO: Looking for IMAGEX.EXE…
INFO: Looking for BCDBOOT.EXE…
INFO: Session key is D5157524-776B-47D9-8FC4-A1C08FFD6F69
INFO: Inspecting the WIM…
INFO: Configuring and formatting the VHD…
INFO: Applying the WIM…
[ 100% ] Applying progress
INFO: Making the VHD bootable with BCDBoot…
INFO: Unmounting the VHD…
Summary:  Errors: 0, Warnings: 0, Successes: 1
INFO: Done.

C:\Program Files\Windows AIK\Tools\amd64>

I’m not sure if I am going to run this way or not.  It’s awfully convenient right now, but I need to test BitLocker more fully to see if I have some integration issues or not.  Keeping both OSes on the same disk means I reduce the total number of disks I take on the road by two.  Two 2.5” disks wouldn’t seem like much, but don’t forget maintaining backup and restored versions of those disks.  Windows 7 and R2 launch events are coming so failure is not an option.

Comments (5)

  1. patrick says:

    i know you want to get the max life out of your 200GB drives – but the ssd disks are way fast!

    keen on doing some comparisons?

  2. Keith Combs says:

    I would love to do some evaluations and comparisons.

  3. TXMikeB says:

    Will there be a rollout "on the road" party like there was for Vista, Office 2007, and Server 2008?

  4. Keith Combs says:

    Yes, but the size and scale is being determined.

  5. TXMikeB says:

    Thanks.  Please let those planning the event to come back to Houston, TX!