Native VHD Boot To Windows 7

Now we have native supported VHD in Windows 7, so what are we going to do about it? One use I found very useful is to native boot to a Windows 7 installed VHD. Why? because it allows me to have multiple Windows systems installed on my computer without using addition hard drives, playing around disk partitions, etc. So how? Here is a 1-2-3.
Step 1 – Create and Attach a VHD
You can simply follow my previous post how to create attach a VHD in windows 7, in which it describes two options to create a VHD natively in Windows 7.
Step 2 – Apply a Windows 7 image to the VHD volume
In order to natively boot to Window 7 image in the VHD file, you have to apply an image to the partition in the VHD. Running Setup from the install DVD and selecting a partition in a VHD for installation is NOT supported. You can simply use Install-WindowsImage Powershell script to apply the Windows 7 image for VHD boot. There is a step-by-step instructions on the site that describes in detail. Here is how in short.
First, have a Windows 7 distribution DVD ready, which contains two WIM files that this script needs to apply the image.
  • \sources\boot.wim, the WinPE image used for RAM disk boot to run Windows setup.
  • \sources\install.wim, the actual Windows 7 image file.
and, download the script from the MSDN code gallery, and save it in a location that you can use later.
Then, launch Powershell in administrator mode by right-clicking Powershell and choosing Run as administrator.
Then, using the following command to list the available images included in the \sources\install.wim image file.
PS >install-windowsimage.ps1 –wim d:\sources\install.wim (assuming the DVD media is in drive D:)
If you get an error that tells you unsigned scripts cannot be executed, see below

Run the following while you are still in Powershell to enable running unsigned local scripts.
PS > set-executionpolicy remotesigned
And, once you located the index number for the edition of Windows 7, run the following command to start applying the image to the VHD file. Ch
ange the index number and the destination drive letter to reflect your settings.



Now you have a bootable Windows 7 installed VHD ready. It looks pretty complicated but believe me, it’s very straightforward. Just follow the instruction and you will be fine. Let’s move to the next step.
Step 3 – Configure the VHD for native boot
In order to natively boot to Windows 7 installed VHD, you need to update the boot configuration on your computer that hosts the VHD to add a new entry to the Windows Boot Loader.
Assuming you have VHD saved in D:\VHD folder, here is two steps to make it work.
First, generating a new entry by copying the current boot loader as following, which will also print out a new generated GUID which you will be using in the next command:
bcdedit /copy {current} /d “Boot Description“
And, update the entry by specifying the VHD path for OS to use.
bcdedit /set {GUID from last step} osdevice vhd=[DriveLetter:]\PathToVHD\VHD_File
bcdedit /set {GUID from last step} device vhd=[DriveLetter:]\PathToVHD\VHD_File
Once it’s done, type bcdedit and you will see something like this below:

And you all set, reboot your computer and you will see two boot entries for you to choose. Select the VHD one and hit enter, and you will be seeing glowing Windows Logo in a few seconds.
If you have any question or are running into any trouble getting this set properly, feel free to leave in the comments below.


Share this

Related Posts

Previous
Next Post »