Creating a Windows 8 Release Preview Master VHD

Cesar De la Torre

You can install Windows 8 into a .VHD following a similar process (like this post I wrote) than when you install it on a raw hard drive, but if you want to have a clean master .vhd which is not related to any specific installation and machine name, and you want to re-use this master .vhd in many machines over time, then the following procedure is much better.


Windows AIK for Windows 7 (To get the imagex.exe tool)
AIK supplement for Windows 7 SP1
– Windows 8 .iso file or DVD

We need the Windows AIK and complement only to get the imagex.exe. So, if you don’t have it, just install Windows AIK setup, and then you must update it with the AIK supplement. In this second case, you just need to copy all the AIK supplement over the Windows AIK installation path, like doing it with the following command (Where we have the AIK supplement in the F:\ drive, like a DVD):

xcopy E:\ “C:\Program Files\Windows AIK\Tools\PETools” /ERDY

Creating the .VHD

This is the first step. We will create a dynamic disk because it takes less space when it is not started, and if desired, you could always change it to a fixed disk.

In order to create a .VHD we can use the Windows Disk Management or the command tool DISKPART.EXE.

I’ll use the Windows Disk Management Tool, as it is easier:

1. In menu “Action” select “Create VHD”.
2. Write the path where you want to store the .vhd file, the maximum file size (I’ll go for 50GB) and the vistual disk type (I’ll go for “Dynamically Expanding”).
3. Initialize the disk with the option “Initialize Disk, in the contextual menu.
4. Select the partition style. Currently the option GPT doesn’t work for virtual machine booting because they do not support UEFI.
5. Then, we create the partition for the operating system. Right click on the free space of the disk and select “New Simple Volume”. In the wizard you must specify the size of the partition, the drive letter, etc.

Burning the Windows 8 .iso image into the .VHD

To do so, we need the command line tool called IMAGEX.EXE, which is included into the Windows AIK, in Windows\Program Files\Windows AIK\Tools\amd64 (or x86, etc.).

Before burning the Windows 8 operating system image we must check and find the index of the concrete Windows 8 installation we want to install (sometimes there are several possible installation within the same .ISO or DVD).

In this case, F:\ drive is the drive where I have the Windows 8 installation bits (DVD or mounted .ISO drive):

imagex  /info F:\sources\install.wim

You’ll get a long output text where you’ll need to find the INDEX NUMBER you want to install. For instance INDEX=“1”

Then, just burn it!!!:

imagex /apply d:\sources\install.wim 1 W:

W:\ is in this case my mounted .VHD where I’m burning the Windows 8 bits.


Setting the .VHD Boot

Writing the boot sector and Master Boot Record

Once we have all the Windows 8 bits within the .VHD, we need it to be able to boot. In order to do so, we need to write a Windows 8 boot sector and the Master Boot Record. We perform this step with the BOOTSECT.EXE command tool. This tool is available within the folder \Boot in the Windows 8 setup bits, and the sub-folder related to our architecture (x86, x64, etc.). So, type:

bootsect /nt60 W: /mbr

Mark the boot partition as active

You can do this step using the Disk Manager, selecting the internal partition of our .VHD and right-clicking on it, then select “Mark partition as active”.

Another choice is doing the same step but using diskpart.exe and the “active” command.


You could boot from this .VHD on any computer, like copying the .VHD and then using BCDEDIT in order to relate a boot option to this new .VHD. The first boot will be like a new configuration where you need to provide the computer name, and a few customization options.


If you want to copy this .VHD and boot from a USB pen, then you also need to provide the boot information (BCD) using the tool BCDBOOT.EXE (available in %WINDIR%\System32), like the following:

bcdboot X:\Windows /s J:

Where W: is our drive for the physical USB-PEN and X: is the drive for the mounted .VHD disk copied into that USB-pen (mounted as a disk).


You might want to change dual boot options, option string names, etc. 

When you want to configure the boot options of windows you can use bcdedit.exe to modify the boot settings.

For instance, once you have booted in Windows 8 (any boot, you might have 2 ‘Windows 8’ option strings… ;-)), you might want to change those boot options strings. In order to do so, start a CMD prompt and run bcdedit.exe (in \Windows\System32) to see the GUID of your boot options:

bcdedit /v

Remember/copy the GUID of your VHD installation and type the following line, of course, changing my ‘xxxxxxxx’ stuff to your GUID.

bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description “Windows 8 .VHD Image”

You can put the description you like, but the above line will change the description for your VHD installation boot option.

You can also change the order of the boot options typing the following:

bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast

Finally, once you have these kind of .VHD images, you can copy it and have as many BOOT options as you want.

The easiest way is to copy an originall boot menu option, like:

bcdedit /copy {Original_GUID_Number} /d “my new description”
bcdedit /copy {current} /d “my new description”
bcdedit /copy {default} /d “my new description”

Type again the following to see the new GUID for your new copied boot option:

bcdedit /v

Copy that GUID to a notepad or a paper…

After that, you must change the 2 pointers within the menu option, so they point to the new/right .VHD file:

bcdedit /set {My_new_GUID_Number} device vhd=[C:]\MyNewVMFile.vhd

bcdedit /set {My_new_GUID_Number} osdevice vhd=[C:]\MyNewVMFile.vhd


Discussion is closed.

Feedback usabilla icon