Non SQL Related Blog: Configuring a Hyper-V VHD to be a boot option on notebook with Windows 7


I have recently been asked by both my colleagues internally at MS and by customers and partners alike how do I get the option to boot into a Hyper-V VHD without the requirement to install Windows Server 2008 R2 on my notebook/PC.

Well I got help from esteemed colleague Daniel Bucherer (Client Technology Specialist and all round Geek Smile) to help me set it up initially and since I get a lot of these questions I sat with Daniel to go through and document the steps so it acts as a reference to me and also hopefully helps you out should you require to create demo, dev, test environments easily.

Below are the steps I undertook on my HP EliteBook 8540w for a Hyper-V based SQL Server BI demo VHD.

1) Open up Disk Manager and assign the System partition a drive letter

2) Attach the VHD using Disk Manager

3) Open a cmd window and go to the drive letter of the VHD attached and change drives to the \windows\system32 directory

4) Run the following command:

bcdboot g:\windows\system32 e: (system drive letter)

5) Try reboot at this stage and you should now see a new menu item appear in the boot menu. Select the option for the VHD and see if it works, if it does great. Chances are that it will blue screens and this is due to the lack of hardware driver supports especially for the hard disk.

6) Reboot the machine and now boot back into your working Windows 7 environment. Attach the VHD again.

To add drivers run the below cmd at cmd – in my case as I had all the HP drivers available on c:\swsetup I ran the below command:

dism /image g:\ /add-driver /driver:c:\swsetup /recurse /forceunsigned

If you don't have the drivers in a directly like c:\swsetup then you can work out the drives you require using the following cmd:

dism /online /get-drivers

Using this look for the drivers with class name, HDC, SCSI Adapter – these are the Hard disk controllers and would be required to install in the VHD image. To find out the location of the inf files for the driver use the below cmd:

dism /online /get-driverinfo /driver:oem2.inf

Once you have worked out the location of each of the drivers then you can use the cmd like below:

dism /image g:\ /add-driver /driver:c:\windows\inf\oem2.inf /forceusigned

Note: You can remove the drive letter for the system disk after Step 4.

Hope this helps you in setting up a demo/dev/test environment quickly on your Windows 7 PC. Thank you Daniel for your expert guidance.