Booting Windows 8.1 Update natively from a .VHDX image


This is very useful when you need to boot Windows natively, but you need to have different environments, like working with BETAS/CTPs, etc., like it is my case. 😉

In many cases HyperV might not suitable for you, for instance, if I want to deploy mobile apps from Visual Studio (Windows Phone apps or Xamarin apps to Android devices), I’d need to connect the mobile devices to USB ports. But, HyperV VMs don’t support USB connections to devices, etc…

Here's some additional info if you want to know more about "Virtual Hard Disks (.VHD/.VHDX) with Native Boot": http://technet.microsoft.com/en-us/library/hh824872.aspx

In the past, I used to follow more complex steps in order to create a Windows 8 or Windows 7 .VHD master image, then booting natively my machine by configuring the boot options with bcdedit. Here’s my old post:  http://blogs.msdn.com/b/cesardelatorre/archive/2012/05/31/creating-a-windows-8-release-preview-master-vhd.aspx?wa=wsignin1.0

I found a newer and shorter way to do it, therefore, a better way. I’m also using now .VHDX rather than .VHD, since I’ll be using Windows 8.1 or further.

Here are the steps. Pretty simple, actually! 🙂

1. You need to have any Windows .ISO image, like a “Windows 8.1 Enterprise with Update (x64) - DVD (English)” from MSDN subscription, or any other version.

2. Download Convert-WindowsImage.ps1 from Microsoft TechNet Gallery ( https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f ) and copy it to a temporary directory.

3. Start the PowerShell console in administrator mode

4. Before executing the PowerShell script, you’ll need to allow scripts executions in the policies of your machine or user. If you want to allow that at a local machine scope, run the following command in the PowerShell console:

Set-ExecutionPolicy Unrestricted -Scope LocalMachine

For more info about those policies, read the following: http://technet.microsoft.com/library/hh847748.aspx

5. Run the script you downloaded as:

.\Convert-WindowsImage.ps1 –ShowUI

6. In the window, choose the required Windows ISO file

7. Choose the SKU (Like Enterprise or Professional)

8. Choose the VHD/VHDX Format (I go for VHDX since I don’t require legacy compatibility and the new VHDX format is more reliable)

9. Select Type. For production systems, I recommend “Fixed”, but for development and testing with betas, since I need many incremental versions, I use “Dynamic” so when the .VHDX is not being used, it will have a much smaller size, just the MB being used.

10. For the size, I go for the maximum allowed by the tool, which is 100GB. But, after installing Windows and if the .VHDX is not being used, it will take just around 8GB or less. But you know, it will grow, eventually.. 😉

11. Make sure that you write the right extension after the filename, like “.VHDX” or “.VHD”, or you’ll get an error.

12. Hit and burn the VHDX! 🙂

image

In the PowerShell console, you’ll see something like the following:

image

Since my .VHDX is Dynamic and it is still not mounted, its size was just something less than 8GB! 🙂

image

MOUNT the .VHDX as a drive in your machine

Right-click the VHDX and mount it. In my case I got the M: as my mounted drive.

Set the BOOT files within the .VHDX

The following steps are needed to make your computer boot from the VHDX file:
1.Open an administrative command prompt via WIN+X Command Prompt (Admin) 
2.Type bcdboot M:\Windows in order to create the boot files in your .VHDX drive.
image

SAVE YOUR “MASTER IMAGE”!!!

3. At this point you have a “MASTER IMAGE .VHDX” that you could use in different machines/hardware since you still didn’t spin it up, therefore, it still doesn’t have any specific driver related to any hardware.

So, un-mount it by right clicking the drive (M: in my case) and select on “Eject”, and copy your current .VHDX file and name it to something like “Windows81_MASTER.vhdx”.

You can continue the process with the original .VHDX now.

STEPS to setup point to your VHDX from the native Windows Boot

1. Make sure the .VHDX is un-mounted.

2. Type bcdedit /v to see the result in the Windows Boot Loader section. You’ll see something like the following.

Search for the path to your .VHDX file:

image

3. Taking the GUID identifier you can change the description in your bootlist by typing:

bcdedit /set {52770d04-0937-11e4-a590-c8d719662ef2} description “Windows 8.1 Enterprise .VHDX”

(Of course, you should have and use a different GUID..)

image

Check it out by typing bcdedit /v again and searching for the path to your .VHDX and the new description:

image

You can also check it out in the Computer properties –> Advanced System Settings –> Advaced –>Startup and Recvovery –>Settings button:

image

If you had configured Hyper-V on your Windows 8.1 computer, don’t forget to enable the hypervisor launchtype:

bcdedit /set hypervisorlaunchtype auto

When messing with the startup, it rebuilds your boot configuration data store. But it doesn’t know if Hyper-V needs to have some specific settings enabled in the boot configuration data store in order to start the hypervisor. In any case, this is not related and you just need to do it if you also have HyperV installed.

Additionally, bcdedit has many useful options, like copying an entry for pointing to another .VHDX that you just copied in your hard drive, etc. Just type bcdedit /? to check it out or see other options that I explain at the end of my old post: http://blogs.msdn.com/b/cesardelatorre/archive/2012/05/31/creating-a-windows-8-release-preview-master-vhd.aspx?wa=wsignin1.0

If you reboot your machine, you’ll be able to select the new NATIVE WINDOWS BOOT but from a .VHDX! 🙂

Windows81_Dual_Boot 

Have fun! 🙂

Comments (14)

  1. Jimmy Zhang says:

    Does vhdx support TRIM on SSDs?

  2. Cesar de la Torre [MSFT] says:

    Note that with the latest version of Convert-WindowsImage like if creating a Windows 10 image, the Convert-Convert-WindowsImage -ShowUI doesn´t work any more because the author changed the approach.

    Now, you need to open-edit the script with PowerShell ISE rather than plain Powershell, and as admin.

    you´ll see the function in the editor.

    Scroll down, and write the call to the function right at the end, after the function, like:

    Convert-WindowsImage -SourcePath H:WIN10.ISO -VHDPath C:VHDsWINDOWS10.VHDX -VHDFormat VHDX -SizeBytes 100GB -Edition Professional

    And finally run the whole script from PowerShell ISE. That works great for creating Master Windows 10 .VHDX 🙂

  3. Cesar de la Torre [MSFT] says:

    Yes, you can do it. You can use Sysprep and re-use the .VHD in different machines, I've done it in many PCs, but I have 3 warnings:

    1. The .VHD has to come from this kind of setup explained in the post. IT cannot come from an Hyper-V VM, at least, it won't be easy/straight to make it work if it comes from an Hyper-V VM.

    2. If spinning up the different machines in the same networks, you'll need to change the MAC addresses of each machine

    3. I don't know why, I haven't been able to re-use a syspreped .VHD in a SURFACE Pro 3. I always got a low level error when starting to boot. When trying with a SURFACE PRO 3 I always had to use a .VHD that was started the first time on a SURFACE PRO 3. Weird..

  4. Is it not possible to native boot a Sysprepped VHD image? says:

    Is it not possible to native boot a Sysprepped VHD image? Isnt that the whole point of using VHD images. And then be able to Hardware Custom fit it after the Sysprep during the first boot?

  5. Cesar de la Torre [MSFT] says:

    I have a Surface Pro 3 and I am able to boot natively from a .VHDK following the method in this blog post.

    IT is important that you cannot use a .VHD or .VHDX coming from HyperV. It has to be made "brand new" for your Surface Pro 3 like I do in this blog post.

    @jerry That error happened to me when using a .VHDX that I created for a different machine. Start from scratch and you should be able to make it work. And btw, when doing this, do not use the docking station until you finished the process..

  6. jerry says:

    I too get the same error as edward. It does not matter what way I try it , still get the pc needs to be repaired. I used the powershell script and followed everything to a T .. multiple times, same error every time. Same error with windows 8.1 different vhd and windows 10, just seems my sufface 3 wont allow me to boot native vhdx

  7. isaac says:

    Hello, I have Windows 10 installed and updated to build 10049 in hyper-v not want to lose the updates then I export vhdx and boot natively on my surface Pro 3 256GB?

  8. Cesar de la Torre [MSFT] says:

    @James You mean installing Linux in a VHD/VHDX and booting natively from it?

    I haven't tried that but I think it is possible. Take a look to the last comment in this thread:

    social.technet.microsoft.com/.../booting-a-linux-vhd

    And that is an old post from the Windows 7 era. It might have evolve even more by now.

  9. James Alan says:

    Can I boot from VHD/VHDX with Linux installed?

  10. Cesar says:

    @ Edward - You might have done any of the steps wrong. This procedure always worked to me when using Windows 8.1. I also use a Surface Pro 3 with dual and even four different boots based on .VHDX..

    In order to recover and boot from the original C: boot, it is pretty simple. Create a bootable recovery USB following the info in the link below. Then, boot from the USB memory stick,  and select within the menu options to "Boot with a different OS", and select the original Windows. Then go to the Control Panel and boot options to set the original C: boot Windows as the default option. Other than that, you'll have the same issue again after re-booting.

    How to use USB recovery drive

    http://www.microsoft.com/.../usbrecovery

    The only scenario where I'm having trouble with this procedure (Native .VHDX boot) is with the new Windows 10 Technical Preview (January 2015) and my Surface Pro 3. On the other hand, I have no issues following this procedure with the Windows 10 Preview from November 2014 and the same Surface Pro 3. A bit weird..

  11. Edward says:

    So I followed this and my PC (Surface Pro 3) is now telling me "Your PC/Device needs to be repaired".

    Hopefully the problem is just with the VHDX and not with my "main" Windows install, but how do I get back to that?

  12. Si, pero si es anterior a Windows 8.1, como Windows 7 o Windows 8, usa .VHD en lugar de .VHDX. El resto del proceso seria similar.

  13. Francisco Suárez says:

    Muchas gracias por este este post.

    ¿Este procedimiento es aplicable a otros sistemas operativos?.

    Saludos

Skip to main content