Share via


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

Comments

  • Anonymous
    January 01, 2003
    Asmar: Thanks for posting and giving me the update.  I'm glad you were able to get things going finally on your W520!!!  Interesting that you have to use the USB2.0 port on the back to boot to a Windows 7 bootable thumb drive.  I was pretty sure my W510 supported a Windows 7 Bootable Thumb drive in the USB3.0 ports on the side of my laptop.  Now, I'll have to go test that out just so I know. JP: It may be best for you to email me at Harold.wong@microsoft.com with screenshots and such or even call me at (425) 706-3501. Harold

  • Anonymous
    January 01, 2003
    If you download each dile individually from dropbox, you are fine.  If you click the Download option from the folder, Dropbox will zip up all the files in the folder and make it available as a single download.  Using this option, you will get a corrupted file due to the overall size of the files. Brandon: It looks like your source files might be corrupt.  Have you tried another source? Harold

  • Anonymous
    January 01, 2003
    Ed, I'm not sure what you mean by offline.  They are live and fully accessible.  There should be 5 files in the folder. Harold

  • Anonymous
    January 01, 2003
    Serian: I'm not sure what you are trying to tell me regarding the boot menu. Peter: When you mount the VHD, it is not persistent.  Upon rebooting, the VHD is dismounted and not automatically remounted. So long as you did things correctly, the entry that is created doesn't really refernve a drive letter (e: in your case) but rather a disk number and partition number.   Harold

  • Anonymous
    January 01, 2003

  1. Issue with Dropbox and Error 509: I have contacted Dropbox to resolve this issue.  Please be patient while I work through this.
  2. You cannot use the VHD as imaging templates.  You also can't convert a VHD to a WIM. Harold
  • Anonymous
    January 01, 2003
    Aaron, Normally, you would be able to use VHDs created in this fashion in Windows 7 Virtual PC.  The reason the ones I created don't work is that I installed 64 bit Operating Systems in these VHDs and Windows 7 Virtual PC does not emulate 64 bit hardware - only 32 bit.  Windows Server 2008 R2 and Windows Server 2012 only come in 64 bit so those cannot be run in Windows 7 Virtual PC.  If you use the Windows 8 VHD to boot from, you can enable Hyper-V and create 64 bit VMs and use the two Server VHDs in your VMs. Harold

  • Anonymous
    January 01, 2003
    Luigi: Are you sure you mounted the ISO image as drive I:?  Also, do you have enough disk space on your C: Drive to create the VHD? Darrell: We don't support running Windows 8 in Virtual PC. Dennis: Thanks!  I did get my Dropbox account reset so it should be working now. 8675309: I'm not sure what you are referring to, but I just mounted the Windows 8 Pro ISO from my TechNet and MSDN subscription and both have the install.wim file and I do not see an install.esd. autobulb: Are you sure you are running command prompt as Administrator?  In the upper left of the command window, you should see Administrator: Command Prompt.  Please double check. Harold

  • Anonymous
    January 01, 2003
    DotNetWise:

  1. In order to perform a Boot to VHD, the VHD file must be stored on a drive that is accessible during the initial boot process (no drivers needed).  USB devices require the OS to install the USB driver before these devices are accessible.  Therefore you CANNOT perform a Boot to VHD with a VHD file stored on a thumb drive.
  2. Depending on how you create the VHD, you can definitely attach it to Hyper-V. Harold
  • Anonymous
    January 01, 2003
    Thomas, Sorry about the error.  It seems Dropbox has not fixed the issue with bandwidth utiliziation on my account.  I am working to correct this.  If you are not able to download in th enext few days, I will have the files on a thumb drive at the event. Harold

  • Anonymous
    January 01, 2003
    Thanks, I'll pass on the 8 GB VM's but the knowledge is good to have.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Mike: Can you please tell me why you think this information is worthless and aweful?  Thanks. Harold

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    August 19, 2012
    Harold - This is great.  Thanks for posting.

  • Anonymous
    August 20, 2012
    Thanks. Oh, your files at http://aka.ms/hwitcampfiles are offline [or otherwise].

  • Anonymous
    August 21, 2012
    Thanks for post, it is very usefull

  • Anonymous
    August 23, 2012
    Wouldn't it be possible to take these vhd files and use them as templates for imaging, or do they need to be converted to wim files first?

  • Anonymous
    August 28, 2012
    Harold, I am getting an error. Error (509) This account's public links are generating too much traffic and have been temporarily disabled! Thanks

  • Anonymous
    September 07, 2012
    Harold Are these also VHDs that I can mount and use in Windows 7 Virtual PC?  I have created the new VMCX file, mounted the VHD in disk manager, but when i try and power these devices on, I get an error.  It says Encountered an error when attempting to use one of its virtual hard disks. Thanks Aaron

  • Anonymous
    September 07, 2012
    files at http://aka.ms/hwitcampfiles not available...

  • Anonymous
    September 20, 2012
    thanks for the tutorial

  • Anonymous
    October 01, 2012
    thanx for the guide but when i use bcdboot to create a start for a vhd image, at restart  the boot menù change to windows 7 style. :(

  • Anonymous
    October 04, 2012
    Everything looks good with the attached VHD and the volume is there but it goes away when I restart.  I get a boot error because it can't find e:windows....  The e volume isn't there.  How do I make the e volume stick so it's there after restarting?

  • Anonymous
    October 06, 2012
    i downloaded this twice and it tells me the file is invalide

  • Anonymous
    October 08, 2012
    Hello Harold, Thanks for this, but I am getting errors when trying to copy the burnt dvd image file to to the virtual drive. Any ideas please? Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation.  All rights reserved. C:Windowssystem32>C:IMAGEX /APPLY F:SOURCESINSTALL.WIM 1 K: ImageX Tool for Windows Copyright (C) Microsoft Corp. All rights reserved. Version: 6.1.7600.16385 [  41% ] Applying progress: 10:47 mins remaining [ RETRY ] Restoring K:WindowsWinSxSx86_microsoft-windows-t..predictionengine. de_31bf3856ad364e35_6.2.8400.0_none_7dc788dca5621de5lm.de-DE-1901.dat again (Error = 23) [  43% ] Applying progress: 12:33 mins remaining [ RETRY ] Restoring K:WindowsWinSxSx86_microsoft-windows-s..chrecognizerenu.a le_31bf3856ad364e35_6.2.8400.0_en-us_575d2f5c80e5c65cl1033.ngr again (Error = 23 [ RETRY ] Restoring K:WindowsWinSxSx86_microsoft-windows-s..chrecognizerenu.a le_31bf3856ad364e35_6.2.8400.0_en-us_575d2f5c80e5c65cl1033.ngr again (Error = 23) [ RETRY ] Restoring K:WindowsWinSxSx86_microsoft-windows-s..chrecognizerenu.a le_31bf3856ad364e35_6.2.8400.0_en-us_575d2f5c80e5c65cl1033.ngr again (Error = 23) [ RETRY ] Restoring K:WindowsWinSxSx86_microsoft-windows-s..chrecognizerenu.a le_31bf3856ad364e35_6.2.8400.0_en-us_575d2f5c80e5c65cl1033.ngr again (Error = 23) [  44% ] Applying progress: 13:29 mins remaining [ ERROR ] K:WindowsWinSxSx86_microsoft-windows-s..chrecognizerenu.ale_31bf385 6ad364e35_6.2.8400.0_en-us_575d2f5c80e5c65cl1033.ngr (Error = 23) Error restoring image. Data error (cyclic redundancy check). C:Windowssystem32>

  • Anonymous
    October 08, 2012
    Worthless info this was awful

  • Anonymous
    October 09, 2012
    The comment has been removed

  • Anonymous
    October 19, 2012
    Some questions #1 If my vhd is on a usb stick, Can I boot to different computers that only have installed Windows 7 on their HDD? #2 Is it possible if I will attach it later to Hyper-V and run it from there?

  • Anonymous
    October 19, 2012
    I followed your article and everything went fine but I didn't find any entry in the MSCONFIG (boot tab) please help?

  • Anonymous
    October 26, 2012
    The comment has been removed

  • Anonymous
    October 26, 2012
    I have mounted and created a windows 8 32bit vhd for virtual pc, but it just spins at DHCP... and later says Reboot and Select proper Boot device or Insert Boot Media in selected Boot device. What am I doing wrong?

  • Anonymous
    October 28, 2012
    Why anyone would say "Worthless info this was awful" is beyond me.  They probably aren't very technically savvy because I followed the guide to the T and I am up and running with Windows 8 on an attached VHD.  The bonus with this method is that it essentially allows you to dual boot Win 7 and Win 8 on the same system.  HUGE!  Thanks for the great info Harold!  FYI - your Dropbox link doesn't work but I didn't really need it anyway.  Thanks again!

  • Anonymous
    November 05, 2012
    install wim on pro iso seems to have been replaced with an esd changing ext. to wim does nothing it does not recognise it. guess i have to wait for install media to arrive to do this.

  • Anonymous
    November 07, 2012
    I get an error when I try to run the bcdboot command: Failure when attempting to copy boot files. I run cmd.exe as administrator as instructed but I can't seem to shake that error. Any ideas?

  • Anonymous
    November 09, 2012
    my guess is its because its an upgrade(www.windowsupgradeoffer.com) from 7. i looked @ it with both 7 zip & WinCDEmu(with hidden files enabled) but still nothing guess us consumers are sol if we want to do this kind of stuff. i do have a copy of the trial iso will try it for the time being since the dvd shipped a week & a day ago by standard mail could be a while.(they gave vista opk 7 upgrade users dhl(canada post express post/usps) level service but now their cheaping out)

  • Anonymous
    November 12, 2012
    I tried it again and made sure I was administrator, same results: http://i.imgur.com/MAF52.png

  • Anonymous
    November 13, 2012
    @autobulb are you using the 64bit iso?if so then that could be why as from what your screenshot shows your using a 32bit version of 7 enterprise/ultimate which means it wont work this way only other way to do this is to boot the windows 8 installer & setup the vhd from there www.zdnet.com/.../4847 pg.3 of that totorial has the necessary commands to do it from there. it may take longer to do it this way but its known to work for situations where people dont have the correct matching architecture(eg. 64bit compatible cpu 64bit version OS)

  • Anonymous
    December 23, 2013
    Pingback from Rapid setup and deployment | Some Things Are Obvious