Installing and running Hyper-V from a USB stick

Microsoft ships Windows Server Hyper-V 2012 in two versions; Windows Server 2012 with Hyper-V as a role and Hyper-V Server 2012 version. The Hyper-V Server 2012 is a free version and offers almost all the components and features that are available in Windows Server 2012 with Hyper-V as a role version. It contains only Hyper-V role installed and it has to be installed on local hard disk like any other Windows installation. What if you need to make Hyper-V Server 2012 available on a USB stick; booting Hyper-V Server 2012 from a USB Stick and make it available for your testing? This is where this article comes handy; explaining the process involved in creating a bootable USB Stick with Hyper-V Server 2012 installed onto it.

The complete process to create the bootable USB Stick is done via command-line tools (mkdir, diskpart, ImageX, BOOTSect, BCDBoot, and REG.EXE) as shown in an example screenshot below:

Throughout the process, you need to have the following items available:


  • 8 GB of space on flash drive.
  • A computer supporting boot from a USB Stick
  • Hyper-V Server prerequisites
  • Install.WIM file from Hyper-V Server Source folder
  • Windows 7 or newer Operating System
  • Windows Automated Installation Kit (WAIK) for Windows 7 or newer
  • Microsoft Hyper-V Server 2012 ISO from Microsoft web site
  • Available drive letters on local computers; Z: and R:
  • As an overview to the process, you will be performing the following steps:
  1. Creating and mounting a VHD file as a Primary Partition on local computer
  2. Formatting as NTFS and assigning a disk label
  3. Applying WIM to VHD file using ImageX tool
  4. Using DISKPART to prepare the USB flash drive
  5. Using BOOTSect and BCDBoot tool to add the boot configuration to USB flash drive.
  6. Removing paging file using the REG command

These are the steps you’ll need to take:

  1. Creating, mounting, and formatting a VHD File

Create the following folders on your local computer:

  • C:\WIMFile – used to store the WIM file
  • C:\HyperVBoot – used to store VHD fileNext, open the command prompt under local administrator credentials and run the following command to create the VHD file which has a 6 GB capacity. The last three commands except “exit” will mount the VHD file as the drive letter Z:
  • Open the Hyper-V Server 2012 ISO file, navigate to the Sources folder, and copy the Install.WIM file to C:\WIMFile folder you created in the first step.

mkdir c:\HyperVBoot
create vdisk file=C:\HyperVBoot\hyperVBoot.vhd maximum=6000 type=fixed
select vdisk file=C:\HyperVBoot\hyperVBoot.vhd
attach vdisk
create partition primary
assign letter=Z
format quick fs=ntfs label=hyperVDisk

Once the VHD file is created in the previous step, your next step is to apply Install.WIM file. Please execute the following commands:

cd /d “C:\program files\Windows AIK\tools\AMD64”
ImageX /apply C:\WIMFile\Install.WIM 1 Z:\

The next step is to prepare the USB Stick you will be using to install the Hyper-V Windows Server 2012 version. As part of the USB Stick preparation process, you will be using DISKPART tool to format the USB drive and copying the VHD File you created in earlier steps to the USB drive. Execute the following commands to get the USB disk number

list disk

Note: Note down the disk number for USB disk

And the following commands to create and format a new partition and assign the letter T: to the USB stick. Replace <USB Disk number> with the number identified in the previous step.

select disk (USB Disk number)
create partition primary
select partition 1
format quick fs=ntfs
assign letter=T

Copy the VHD file C:\HyperVBoot\hyperVBoot.vhd to the USB drive letter assigned as T:

  1. Using BOOTSECT tool to update the MBR code

BOOTSect tool allows you to update the MBR record on the disk (USB Stick in thiscase) so you can boot Hyper-V Windows Server 2012 from USB Stick.

Run the following BOOTSect command to update the MBR

cd /d “C:\program files\Windows AIK\tools\PETools\AMD64\”
BOOTSect /nt60 T: /force /MBR

and the DISKPART command to attach the VHD file to the T drive.

select vdisk file=T:\HyperVBoot.vhd
attach vdisk

Use the BCDBOOT tool to copy the necessary boot files so that you can boot your USB stick. Run the following command:

BCDBOOT Z:\windows /s T:

Since you are installing Hyper-V Windows Server 2012, you must remove the Pagefile requirement. Use the following command to load the registry from the VHD file and then remove the page file value and entry from the registry:

REG load HKLM\HyperVRegistry Z:\windows\system32\config\system
REG add “HKLM\HyperVRegistry\ControlSet001\Control\Session Manager\Memory Management” /v PagingFiles /t REG_MULTI_SZ /d “” /f
REG delete “HKLM\HyperVRegistry\ControlSet001\Control\Session Manager\Memory Management” /v ExistingPageFiles /f
REG unload HKLM\HyperVRegistry

Finally the following commands to detach the VHD file from the T drive:

select vdisk file=T:\HyperVBoot.vhd
detach vdisk

Remove the USB stick from this computer and attach it to a computer which supports all Hyper-V prerequisites to boot Hyper-V Windows Server 2012 from a USB Stick. Please make sure to change the boot order in computer BIOS in order to boot from the USB Stick.


Required software can be downloaded from below links:

Hyper-V 2012 Server Core Free edition:

WAIK for Windows 7:

Original link (!);

Comments are closed.