Sunday, March 11, 2012

Setting up Windows 8 Consumer Preview to Boot from VHD

Being in a careful situation, not wanting to mess my Windows 7 and configurations I have done seeing as I would probably need to work.. Smile … I opt to configure Windows 8 to boot from VHD. For some reason, when i tried this in the Developer Preview, I couldn’t get it working. I have Windows 7 running natively, and dual booting with Windows Server 2008 R2 booting from VHD.

I had referred to a couple of blogs for guidance, and one in particular gave me a good reference point on Hyper-V.nu

Here is how i did mine:

Step 1: Download the Windows 8 Consumer Preview ISO

Step 2: Have installed UltraISO or PowerISO. We need this to mount the ISO to copy out the install.wim image

Step 3: Create a directory where you would like to place the VHD file. In my case, I created Z:\VHD\Win8Beta

Step 4: Mount the Windows 8 ISO

Step 5: from the mounted drive, copy the \sources\install.wim to the created directory [e.g. Z:\VHD\Win8Beta]

Step 6: Download the Install-WindowsImage PowerShell script and copy it into the same directory as above

Step 7: Create the VHD using the following steps in Windows 7

Step 7a: Launch the Computer Management app

Step 7b: Right-click Disk Management and select Create VHD

1

Step 7c: Create the VHD in the directory created earlier with the size of your choice. I wanted to do some performance testing, so I selected Dynamically Expanding for my disk type

2

Step 7d: Once done, from the Disk Management control panel, you should see the created and attached VHD. Proceed to initialize the Disk

4

Step 7e: Next create a Primary partition

5

6

Step 7f: Assign a drive letter so that we can perform the WIM install later. In my case i assigned [M:\]

7

Step 7g: Perform a Quick Format of the drive 

8

Step 7h: You should have an end result of a formatted VHD attached to the drive letter. Once again ensure you have the install.wim, the powershell script, and the created VHD in the directory you created

9

10

Step 8: Apply the WIM Image to the VHD using the PowerShell script

Step 8a: Launch a CommandPrompt run as Administrator

Step 8b: Change to the directory containing the VHD, WIM image and PowerShell script {cd z:\VHD\Win8Beta}

Step 8c: launch powershell {> Powershell}

Step 8d: Run the following powershell commands one by one (replace the drive in the command below with the one you created):

     PS> set-ExecutionPolicy Unrestricted
     PS> .\Install-WindowsImage.ps1 –WIM Z:\VHD\Win8Beta\install.wim
     PS> [R]un once
     PS> .\Install-WindowsImage.ps1 –WIM [drive]:\vhd\install.wim –Apply –Index 1 –Destination W:
     PS> [R}un once

The steps above are shown in this screenshot below:

11

Once done, you should see the Windows 8 system populated in the mounted drive

12

Step 9: Configure the Boot Menu for the VHD to Native Boot

Step 9a: In the Command Prompt window, execute:

     > bcdboot m:\windows

     *in my case, m: was the drive that i used to assign the VHD to.

Step 9b: check your boot entries:

     > bcdedit /v

Below shows a screen shot of Step 9:

14

Step 10: Reboot and configure your sysprepped Windows 8!

You will see the new Boot Menu

WP_000261

Hope these steps are clear enough for you to try it out. And do post comments if you have noticed any errors or it went successfully for you.

4 comments:

David said...

I followed the directions very closely but when my pc rebooted, I didn't get a display. I opened BCDedit and could see the entries. I attempted to delete the Windows 8 entry from the BCDedit prompt and I still don't have my display. It appears it's still looking for the Win8 to boot to.

David said...

I followed the instructions pretty closely but when my pc rebooted, I didn't get a display. I looked at BCDedit and could see the entries. I then deleted the entry for Windows 8 using bcdedit /delete {id} and set the Windows 7 to default but still can't boot to Windows 7. I've tried to restore and rebuild the bcd store with no luck.

David said...

I'm not sure what went wrong. I followed the instructions closely and when I rebooted (expecting to see Windows 8) I didn't see anything. I looked in BCDedit and could see the entries but no luck. I removed the Win 8 entry, no luck. I repaired/recreated the BCDstore and still no luck.

Unknown said...

Impeccable. Awesome. Thankyou.