Native VHD Boot to Windows 7

Posted by Kent on May 19th, 2009, in Featured, How to, IT Pro, Virtualization tagged in: , , , ,
FREE scan: Click Here to Fix Windows 7 Errors & Improve Windows 7 Performance

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.

image

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. Change the index number and the destination drive letter to reflect your settings.

image

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:

image

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.

Subscribe to W7H Tips & Tricks (Why?)

Email:

You may also like:

Comments (11)

  1. Wazzup says:

    I followed your procedure (under windows 7), but I got:

    Windows Boot Loader
    ——————-
    identifier {96ffc112-8b7c-11de-ba40-8dcd7e725f2c}
    device vhd=[E:]7.vhd
    path Windowssystem32winload.exe
    description vhd
    locale en-US
    inherit {bootloadersettings}
    osdevice vhd=[E:]7.vhd
    systemroot Windows
    resumeobject {96ffc110-8b7c-11de-ba40-8dcd7e725f2c}
    nx AlwaysOff

    Which is not only different than your example, but worse, it doesn't work (I get an error message about an illegal entry in the bootloader of some sorts at boot time)

  2. windows7hacker says:

    @wazzup, which version of Windows 7 are you running? It seems like that only ultimate and enterprise version of Windows 7 support native boot VHD.

    Cheers.

  3. Julian says:

    Hello,

    I am getting an error while i am running de script…

    I have got : “… Unable to open/create .wim file … Error = 13″ At C:/install-windows.ps1 : 805 char 27

    If you can help me would be great.

  4. windows7hacker says:

    You may want to try this tool to help you out.

    http://www.windows7hacker.com/index.php/2009/12...

    Cheers.

  5. julian says:

    hello thanks for your first answer but I found that it was the cd that was corrupted…now I've got another proble.
    When I write bcdedit /copy {current} /d “Boot Description“
    it say a description for the new entry must be specied…the parameter is incorrect.

    thanks for the answer

  6. windows7hacker says:

    hmm…weird. the command seems to be right. Maybe instead of “boot description”, try something different, e.g. “Win7VHD”.

    Cheers.

  7. julian says:

    hello thanks for your first answer but I found that it was the cd that was corrupted…now I've got another proble.
    When I write bcdedit /copy {current} /d “Boot Description“
    it say a description for the new entry must be specied…the parameter is incorrect.

    thanks for the answer

  8. windows7hacker says:

    hmm…weird. the command seems to be right. Maybe instead of “boot description”, try something different, e.g. “Win7VHD”.

    Cheers.

  9. fjctp says:

    After I type in “set-executionpolicy remotesigned”
    The error was still shown.
    What's wrong?
    Thanks

  10. windows7hacker says:

    Did it run successfully? The command is to enable the local script so you have to make sure the command is run successfully.

    Cheers.

  11. Lyndon Arcuo says:

    I have been measuring the AC adapter with analog multitester, there indicate approximately 21vdc while behind the laptop shows 19vdc. is it normal? Besides the AC adapter, what I should check next ..?

    Trackbacks/Pingbacks (4)

  1. Native Boot to Windows 7 in VHD from Windows Vista | Windows 7 Hacker
    [...] kent on May 21, 2009 under How to, Tips & Tricks, Virtualization. // Now we now we can native boot to a Windows 7 installed VHD file, but it requires you have Windows 7 installed on the host computer. Is it possible to do the same [...]
  2. Windows 7 VHD Native Boot without any Hosting Operation System | Windows 7 Hacker
    [...] OS has to be on either Windows 7 or Windows server 2008 R2, the host operation system can be either Windows 7, Vista, or even nothing. If you don’t believe it, follow the steps below, and tip your hat to [...]
  3. 7 Things about Windows 7 Native Boot VHD | Windows 7 Hacker
    [...] just purely not supported. If you follow our step-by-step how to set up a VHD native boot instruction, you will actually notice that it’s just technically not possible specify the correct path to a [...]
  4. Native Boot VHD on a Windows XP Computer [Virtualization] | Windows 7 hacker
    [...] are new here, you might want to subscribe to the RSS feed for updates on this topic.First, it’s Native Boot VHD on Windows 7, and then on Vista, and without any hosting OS, now it can be done on a Windows XP machine too. [...]

Leave a Reply