Installing and running Hyper-V 2012 R2 from a USB stick

Hyper-V 2012 R2 Server is the free version of Hyper-V and it offers all the components and features that are available in Windows Server 2012 R2 with Hyper-V. It is a Windows version containing only the Hyper-V bits and the Windows Failover Cluster, but it has to be installed as any other Windows Server on the local hard disk.

What if you could run Hyper-V 2012 R2 Server from a USB stick, allowing you to take it wherever you go in your pocket, making your Hyper-V 2012 R2 available on any computer through a USB boot? It will come in very handy when you need a Hyper-V ready for a test environment or even just to run your virtual machines and bring all of them with you on a USB stick.

How it works?

Almost the whole process to create the USB stick with Hyper-V 2012 R2 is done via commands.

1. The first thing was to create a new VHDX file and enable it to receive the Hyper-V 2012 R2 image by creating a primary partition and formatting it using NTFS.

2. Then, by using the DISM tool, you actually apply the Hyper-V 2012 R2 Server image that is in the Install.wim file to the VHDX file mounted on the R drive.

3. After that, the USB flash drive was prepared and formatted via Diskpart. The VHDX file containing the Hyper-V 2012 R2 image was copied onto it and it was configured with the boot configuration using the BCDBoot tool.

4. The last commands removed the paging file to improve the USB stick performance.

5. That’s it. In the first USB boot, you will have to finish the Hyper-V 2012 R2 Server installation process.

I use this option for all my sessions when I want to demonstrate the features and how powerful is Hyper-V 2012 R2. My daily desktop is Windows 8.1 Enterprise (with hyper-V enable). It’s not recommend to have this installation on any other server that you may use for production environment or even for any other environment that will request sensitive data (like Testing).


To run Hyper-V 2012 R2 from the USB stick, you need at least an 8 GB flash drive. The computer which is to run the Hyper-V needs to support boot from USB and the Hyper-V pre-requisites. In this casa I use a 24 GB USB 3.0 stick.

To create the USB stick with Hyper-V on it, you need to download and install the Windows Automated Installation Kit (WAIK) for Windows 8.1 or a newer version, on the computer that will be used to perform this recipe. The WAIK for Windows 8.1 can be downloaded from the following link:

You will also need to install .NET Framework 4.5 and download Microsoft Hyper-V Server 2012 R2 from the Microsoft website. Open the Hyper-V Server image file that you downloaded, navigate to the Sources folder, and copy the Install.wim file to a local folder on your computer.

How to install Hyper-V 2012 R2 Server on USB Stick

The following steps will show how to prepare a USB flash drive to create a bootable version of

Microsoft Hyper-V 2012 R2 Server.

1. Open the command prompt as an administrator to create the VHDX file that will be used to add the Hyper-V image on the USB stick.

2. Run the following commands to create a folder named HYPVBOOT and the VHDX file named HYPV2012R2.VHDX with 6 GB capacity. The command will also attach the VHDX as the local letter R.

mkdir c:hypvboot


create vdisk file=c:hypvbootHYPV2012R2.vhdx maximum=6000 type=fixed

select vdisk file=c:hypvboot HYPV2012R2.vhdx

attach vdisk

create partition primary

assign letter=r

format quick fs=ntfs label=HYPV2012R2


3. After creating the VHDX file, you can apply the Hyper-V 2012 R2 Server image using the INSTALL.WIM file. From the following command change <architecture> to AMD64 or IA64, based on the architecture you want to create and then boot your USB stick. Change <path to wim > to the INSTALL.WIM file path.

cd /d “c:Program Files (x86)Windows Kits8.1Assessment and Deployment KitDeployment Tools<architecture>DISM”

dism.exe /apply-image /Imagefile: <path to wim> /Index:1 /ApplyDir:R:

4. Using the diskpart tool you have to detach the virtual disk from your computer using the following command lines:


select vdisk file=c:hvpvbootHYPV2012R2.vhdx

detach vdisk


5. Now you can attach the USB stick you want to use to be formatted and to receive the VHD file created in the previous steps.

6. Use the diskpart tool again to identify the USB stick disk number.


list disk

7. Use the following commands to create and format a new partition and assign the letter Z to the USB stick. Replace <USB Stick number> with the number identified in the previous task.

select disk <USB stick number>


create partition primary

select partition 1


format quick fs=ntfs

assign letter=v


8. Copy the VHDX file created in step 2 to the V: drive where the USB stick is attached.

9. Use the Bootsect tool to update the master boot code. From the following command, change <architecture> to AMD64 or IA64, based on the architecture that you want to create. Boot your USB stick.

cd /d ” c:Program Files (x86)Windows Kits8.1Assessment and Deployment KitDeployment Tools<architecture>BCDBoot”

bootsect /nt60 v: /force /mbr

10. Use the diskpart tool again to attach the VHDX file to the Z drive.


select vdisk file=v:HYPV2012R2.vhdx

attach vdisk


11. Use the BCDBoot tool to copy the necessary boot files so that you can boot your USB stick.

bcdboot r:windows /s v:

12. As you are installing Hyper-V Server on a USB flash drive rather than a normal hard drive, you have to disable the paging file. Use the following command to load the registry from the VHDX file:

reg load HKLMHyperVTemp r:windowssystem32configsystem

13. Remove the page file value from the registry with the following command:

reg add “HKLMHyperVTempControlSet001ControlSession ManagerMemory Management” /v PagingFiles /t REG_MULTI_SZ /d “” /f

14. Delete the page file entry with the following command:

reg delete “HKLMHyperVTempControlSet001ControlSession ManagerMemory Management” /v ExistingPageFiles /f

15. Unload the temporary registry with the following command line:

reg unload HKLMHyperVTemp

16. Type the following commands to detach the VHD file from the Z drive:


select vdisk file=z:HYPV2012R2.vhdx

detach vdisk


17. Now you can remove the USB stick from your computer and attach it onto another computer to boot Hyper-V 2012 R2 Server.
NOTE: You may need to change the boot order or the boot configuration from your computer BIOS to allow it to boot from USB.

18. At the first bootup, your bootable Hyper-V will be loaded and the system will prompt you to add the new administrator password. Type the new password twice and click on OK.

19. After the first login, Hyper-V will load the SConfig tool, allowing you to change the most common settings using a friendly command-line interface.

20. Now you can set up your Hyper-V Server and enable remote administration to manage it, using Hyper-V Manager from another computer.

Marcos Nogueira

With more than 18 years experience in Datacenter Architectures, Marcos Nogueira is currently working as a Principal Cloud Solution Architect. He is an expert in Private and Hybrid Cloud, with a focus on Microsoft Azure, Virtualization and System Center. He has worked in several industries, including Aerospace, Transportation, Energy, Manufacturing, Financial Services, Government, Health Care, Telecoms, IT Services, and Gas & Oil in different countries and continents. Marcos was a Canadian MVP in System Center Cloud & Datacenter Managenment and he has +14 years as Microsoft Certified, with more than 100+ certifications (MCT, MCSE, and MCITP, among others). Marcos is also certified in VMware, CompTIA and ITIL v3. He assisted Microsoft in the development of workshops and special events on Private & Hybrid Cloud, Azure, System Center, Windows Server, Hyper-V and as a speaker at several Microsoft TechEd/Ignite and communities events around the world.

14 Replies to “Installing and running Hyper-V 2012 R2 from a USB stick

  1. Thank you for sharing this very informative step by step details of how to configure the Hyper-V R2 to run from a USB stick.

    Before I embark on setting it up on my USB stick I have a question for you. With this USB boot option does this configure the Hyper-V installation as a Headless configurations? or I will also be able to install applications (off course subject to having the disk space on the boot drive) which will have the Windows 2012 GUI? The reason I ask is I would like to install it as a MDT2012 server for automating deploying Windows OS for my training lab.

    I was intending to using a external 100GB USB drive instead of a standard 8-16GB stick as the boot drive.

    I have a lab setup on my home Shuttle PC which I boot using a ESXi5 SD Card USB (headless) and wanted to also setup something similar with Hyper-V but wanted to be able to use the Windows GUI for installing applications etc so I can use the same PC for training.

    1. Hello Mike,
      Thank you for visiting the blog!

      After you install Hyper-V on the USB you can run whatever you want on the server. I have a SSD of 480GB that i run all my demos on this USB drive.
      I have a couple of VMs runing on this USD Drive while i’m doing my demos.
      Just be aware that it’s only for a test/demo purposes. This scenario it’s not support by Microsoft.

  2. Hi Marco, thanks for sharing the detail guide. I followed the steps but I get the following error when I boot from the USB stick. “An operating system wasn’t found.”

    Appreciate your help.

  3. I am amazed at how lengthy a process this is: why is it that Microsoft, with every new Windows version, seems to make deployment more and more onerous?

    What a great step-by-step guide! Very readable and understandable. I think I found something wrong in it, however – please forgive me if I’m wrong:

    In Step 4, we dismounted the R: volume, in order to be able to copy the .vhdx file to the USB drive. Then, in Step 11, we use the bcdboot command to copy the necessary boot files from r:windows. The r: drive was dismounted in Step 4, remember?
    Also, Steps 7 and 10 refer to a Z: drive – you meant V: didn’t you?

    Thanks for all of this – it’s been very helpful, at least so far. I haven’t got it working yet, but I think the R: drive thing was messing me up.

  4. Went through the entire process twice, and can’t get it to work. Not sure what I’m doing wrong. Says it can’t find windowssystem32winload.exe. 0xc0000102 error.

    1. The solution provided by SPIKEMANS above worked for me. In my case, I changed it to [D:] instead of [C:] because my USB took letter D (not C as in the case of SPIKEMANS. It appears that the issue is that some hardware does not recognize VHDX files as they’re new (?). Anyway thanks SPIKEMANS for your help!

  5. Well, I am glad for those of you who have had success with this, but we have just spent two days trying to get this to work and have given up. Once again, Microsoft comes up short when it comes to providing options for using their products. If anyone has any luck getting this to work with Hyper-V server 2012 R2, let us know.

  6. You’ll never gonna believe this, but this seems to work for me.

    1) Rename the .vhdx file to .vhd, in my case ‘HYPERV2012R2.vhd’
    2) Put the USB in to your server
    3) Boot the server using a Windows 2012 DVD
    4) Select your language, click Next, then select ‘Repair your computer’
    5) Select ‘Command prompt’
    6) Run ‘bcdedit /enum’, it’s probably still pointing to your .vhdx file (check ‘device’ and ‘osdevice’)
    7) Fix this by using bcdedit, I used;
    bcdedit.exe /set {default} device vhd=[C:]HYPRV2012R2.vhd
    bcdedit.exe /set {default} osdevice vhd=[C:]HYPRV2012R2.vhd
    to fix my bcdboot config
    8) Now remove the Windows dvd and boot from USB.

    It took quite some time too boot but after 20 mins it showed a ‘Getting devices ready’ message…

    1. Thanks so much SPIKEMANS!!!!
      your solution worked for me. It appears that VHDX is not recognized by some hardware computer as it is a new file format (?)
      In my case I pointed it to D: drive not C: drive because my USB was the D: drive not C

      Thanks again!

    1. Don’t use copy & paste. When you type the command, it will work. I guess it has something to do with the quote signs.

Leave a Reply

Your email address will not be published. Required fields are marked *