Native VHD Boot to Windows 7

Posted by on May 19th, 2009, in Featured, How to, IT Pro, Virtualization and tagged , , , ,

FREE eBook Download - Windows 7 - The Pocket Guide

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:

  • Pingback: Native Boot to Windows 7 in VHD from Windows Vista | Windows 7 Hacker

  • Pingback: 7 Things about Windows 7 Native Boot VHD | Windows 7 Hacker

  • Pingback: Windows 7 VHD Native Boot without any Hosting Operation System | Windows 7 Hacker

  • Wazzup

    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)

    • windows7hacker

      @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.

  • Pingback: Native Boot VHD on a Windows XP Computer [Virtualization] | Windows 7 hacker

  • Julian

    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.

    • windows7hacker

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

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

      Cheers.

      • julian

        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

        • windows7hacker

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

          Cheers.

  • julian

    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

    • Josh

      when you type the description dont space it worked for me

  • windows7hacker

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

    Cheers.

  • fjctp

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

    • windows7hacker

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

      Cheers.

  • http://www.laptopparamedic.com Lyndon Arcuo

    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 ..?

  • http://www.windowsbootcd.com Juliana Richards

    by the way, this Windows boot CD is easy to use and works

  • Pingback: Limitação chata do boot nativo em VHD « Devaneios Lógicos Inefáveis

  • http:electroninx.bravehost.com sunshinekha

    I tried doing this with Windows 7 Professional 32-bit and Windows Server 2008 R2, ended up with an error in the bootloader.

    It says:
    Status: 0xc000000f
    Info: The configuration for an element within the object is invalid in the boot configuration data store.

    The associated Windows Boot Loader entry may not be available for selection until the problem is rectified by an administrator.

    bcdedit is the same as yours, except for the variable, only description for Windows Server 2008 R2 is bootdescription.

    When I open Disk Management, the vhd is not attached. Even if I attach it, it is not attached after reboot.