How to Create Windows 8 VHD for Boot to VHD using simple, easy to follow steps

I just finished holding a few Windows 8 / Windows Server 2012 Installfests both with IT Pros in mind and with Developers in mind. Time and time again, I got asked the same questions around how to create the VHD that has the Windows 8 installation in it. There are quite a few blog posts out there and so I didn’t create my own, but it became evident to me that the ones most often referenced are very hard to follow and require lots of command line utilities that make it hard for people to duplicate. For that reason, I have decided to create my own blog post with much simpler steps using mostly GUI based tools. The steps I am outlining below can be used to create a Windows 7, Windows 8, Windows Server 2008 R2 or Windows Server 2012 VHD.

I have placed the imagex.exe in my drop box folder so feel free to grab them: https://www.dropbox.com/sh/hwtz3hqtz589wgz/ug3YlEj_sb?m

In order to perform the steps in my blog, there are a couple of things that you will need to have access to – all of which are free. I will use a deployment utility called ImageX.exe from the Windows Automated Installation kit (WAIK). Also, you will need to have some way to either mount an ISO image or have the DVD or thumb drive with the Windows 8 installation media on it. I happen to use a freeware tool called Magic ISO CD/DVD Manager to mount ISO images.

Before I provide the detailed steps, let me just provide an overview of the process.

  1. First, I need to be running Windows 7 or higher or Windows Server 2008 R2 or higher in order to perform these steps and have administrative access.
  2. I then need to create a VHD file and format it.
  3. Mount the ISO of Windows 8 (or have the thumb drive or DVD inserted or just have the source files available).
  4. Open a Command Prompt (run as Administrator).
  5. Use ImageX to “install” Windows 8 into the VHD.
  6. Add the installation of Windows 8 to the boot menu.

Now, for the details behind the above 6 steps. I will be providing screen shots of this process from a Windows 7 machine.

Create and mount VHD

  • A. To create and mount the VHD, I will use the Computer Management console to access Disk Management. I can start this by running it from the Administrative Tools Group or right click on Computer and choose Manage.

    managecomputer_thumb2

  • B. Once Computer Management console opens, I will click on Disk Management on left pane and wait for the list of drives to refresh. Once the list of drives appear in the middle pane, I will right click Disk Management and select Create VHD.

    managecomputer-disk_thumb6

  • C. The Create and Attach VHD Wizard appears. I have to provide a name of the VHD file that I want to create (specify directory location), size and type (dynamic or fixed). You can specify the size and type that meets your needs, but keep in mind that the size of the partition you set is important as you will need that much actual free disk space in order to boot to that VHD. Also the type determines how much disk space will always be in use. Since I use laptops for most of my work and I don’t have 1 TB laptop drives, I try to keep the size of all my VHDs that I use for multi-boot purposes to a minimal size. I find that 20 GB partitions is plenty and that dynamically expanding work just fine for my purposes.

    createvhd_thumb2

  • D. Once I click OK, the new VHD file is created and automatically mounted and visible in Disk Management. From there I right click Disk 2 and select Initialize to Initialize the disk as MBR. After the disk is initialized, I create and format a simple volume.

    initializedisk_thumb5

  • E. After the disk has been formatted, Windows 7 automatically assigns a drive letter to the volume (in my example, it is F:). I have also mounted the ISO of Windows 8 Enterprise 90 Day Eval and it is available as drive E: in my example.

    managecomputer2_thumb3

  • F. I then start a command prompt running as Administrator and go to the directory in which my ImageX.exe is located (makes it simple and in my case it is C:\Source).

  • G. In the command prompt, I issue the following command:
    imagex /apply e:\sources\install.wim 1 f:\

    I am essentially installing Windows 8 from the install.wim file located in the sources directory of the source files and selecting the 1st OS instance in the WIM file and installing it to drive F:\ (VHD file)

    imagexstart_thumb2

  • H. Once the process completes, I can dismount the VHD and save a copy off for future use or immediately add it to the boot menu. To dismount the VHD, go to Disk Management and right click Disk 2 and select Detach VHD.

    detachvhd_thumb4

  • I. Once I make a backup copy of the VHD file for future use, I will go ahead and Mount the VHD again to add that installation to the boot menu. To do this, I will right click Disk Management and select Attach VHD. The Attach VHD Wizard will start. I can either browse to the VHD or just type it in the Location field.

    attachvhd2_thumb2

    attachvhd3_thumb2

  • J. The VHD will be mounted and will be assigned a drive letter by the system. In my case, it is drive F: again.

  • K. Go back to the Administrative Command Prompt and type the following command to add the installation to the Boot Menu:

    bcdboot F:\windows

    bcdboot1_thumb2

  • L. Once the command finishes, you will now have the new Windows 8 entry in your boot menu.

The first time you boot to this installation, Windows 8 will detect your devices and install the appropriate drives and then reboot. Upon reboot, you will configure the computer name and a user account like you normally would on a new Windows 8 installation.

If you no longer want to have this option in your boot menu, use MSCONFIG (boot tab) to delete the unwanted entry.

Hopefully, this simple and easy to follow guide will help you to successfully create and boot to your own installations of Windows 8 (or Windows Server 2012).

Harold Wong