One of the coolest features in Windows 7 is the ability to boot VHD files. I find this very useful for having multiple systems on my laptop, for connecting to different networks. Apart from my installed Windows 7, I have a Windows 7 for connecting to our corporate network, as well as one for my lab environment and one to record instruction videos and host webinars on. So in total I can choose between 4 Windows 7 systems when I’m booting my laptop. And as I keep a copy of my master VHD, I can quickly create additional systems. I also make a back-up every week of my production systems, just for a quick restore if it’s needed.
Setting up these systems is very easy. To prepare for this, download and install the Windows Automated Installation Kit for Windows 7, as we will be using the ImageX utility from the kit. You will also need the installation DVD for Windows 7.
Step 1: Creating a VHD
There are two ways of creating the VHD files. First I’ll show how to create those via the GUI, then the easy steps of using the DISKPART utility to do the same.
- Open the Computer Management console and right-click on Disk Management.
- Select the ‘Create VHD’ option.
- Next select the location and filename, as well as the size for the VHD. A basic installation of Windows 7 requires roughly 5GB of space. I always create a VHD of 20GB. You will also need to select if you want a dynamically growing VHD (less disk space required at the start) or a fixed size VHD (larger but you won’t run out of disk space later).
- The creation of the disks takes anywhere from a second (dynamically expanding) to a few minutes (fixed size). The VHD will be automatically attached in the Disk Manager. The next step is to initialize the disk. Right-click the disk and select ‘Initialize’.


- The final step in preparing the VHD disk is to format it. In this process you will select a drive letter for it, you can use any free letter for this.

After formatting the VHD disk you will see a 20GB drive in your Explorer. If you look at the VHD file, you will notice that it’s either 20GB (fixed space) or much smaller when you are using a dynamically expanding file.
Using the DISKPART utility you can achieve the same results. Open a Command Prompt with elevated rights and start DISKPART. The use the commands as in the screenshot below.
Step 2: Installing Windows 7 into the VHD disk
For this we will be using the ImageX utility and the install.wim file from your original Windows 7 installation media. If you are using the Windows 7 Enterprise DVD, then there is only one edition of Windows 7 in the install.wim file. But if you are using a regular installation DVD, you will have to choose which edition to unpack into the VHD file.
For convenience, I have copied the ImageX.exe file from the \Program Files\Windows AIK\tools folder (it’s actually in a subfolder there based on the OS version you’re using, so the x86 if you have Windows 7 32-bit installed) to a folder in the root of my drive.
- Open a Command Prompt with elevated rights and go to the folder with ImageX. To see which number corresponds with the edition of Windows 7 you want to install, use the following command (assuming D:\ is your DVD drive or drive with the installation media):
ImageX /info d:\sources\install.wimYou will see all the editions listed. Look for the edition you want to install and the corresponding Image Index number.
- Then apply the image to your VHD disk. Use the following command for that (assuming X:\ is the drive with your mounted VHD disk):
ImageX /apply d:\sources\install.wim <image number> x:\
Depending on your installation source, applying the image takes about 15 minutes.
Step 3: Configuring your boot options
The final step is to use BCDEdit to configure the boot loader to allow you to boot from your new Windows 7 VHD.
- Open a Command Prompt with elevated rights.
- Copy the current boot option to a new one with the command:
bcdedit /copy {current} /d “<description for new boot option>” - BCDEdit will return a new GUID for the new boot option. Mark and copy this GUID, as you will need this for configuring the boot option.
- Point the device and the OS device to the new VHD. Instead of using the full path to the VHD file, we will use the option [locate]. This will tell the boot loader to search the disk for the correct file and allows you to move the VHD file around. Use the following two commands:
bcdedit /set <guid> device vhd=[locate]\<folder>\<vhd filename>
bcdedit /set <guid> osdevice vhd=[locate]\<folder>\vhd filename>
Update: in the screenshot below the vhd= statement is wrong, as I forgot to add the folder where the VHD is located. I noticed that this morning when I tried to boot my VHD. I’ll update the screenshot later today.
- Some x86 systems will need a boot option for the kernel to detect the hardware. I never needed this, but if you experience problems when booting your VHD disk, use the following command:
bcdedit /set <guid> detecthal on - Confirm the correct creation of your VHD boot system with the command:
bcdedit /v

- If you want to remove a boot option, you can do this with the command:
bcdedit /delete <guid> /cleanup
And this is all it is to native-boot a VHD disk with Windows 7. You can do some nice things with differential disks, cloning disks and even use Hyper-V created VHD disks. But as a start, this will save a lot of time configuring and installing your system again and again. I know it has for me.
Thanks to Mark Minasi for his excellent session on this topic during Tech-Ed Europe 2009 in Berlin. Also thanks to my colleague Andreas van Wingerden at Citrix Benelux for doing most of the research. Much appreciated






