
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:
Requirements
- 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:
- Creating and mounting a VHD file as a Primary Partition on local computer
- Formatting as NTFS and assigning a disk label
- Applying Install.WIM to VHD file using ImageX tool
- Using DISKPART to prepare the USB flash drive
- Using BOOTSect and BCDBoot tool to add the boot configuration to USB flash drive.
- 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 file
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.
Next, 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:
|
1 2 3 4 5 6 7 8 9 |
mkdir c:\HyperVBoot
diskpart
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
exit
|
2. Applying Install.WIM image and detaching the VHD file
Once the VHD file is created in the previous step, your next step is to apply Install.WIM file. Please execute the following commands:
|
1 2 |
cd /d "C:\program files\Windows AIK\tools\AMD64"
ImageX /apply C:\WIMFile\Install.WIM 1 Z:\
|
And using DISKPART tool you detach the virtual disk from your computer:
|
1 2 3 4 |
diskpart
select vdisk file=C:\HyperVBoot\hyperVBoot.vhd
detach vdisk
exit
|
3. Preparing your USB Stick
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
|
1 2 |
diskpart
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.
|
1 2 3 4 5 6 7 8 9 |
select disk (USB Disk number)
clean
create partition primary
select partition 1
active
90
format quick fs=ntfs
assign letter=T
exit
|
Copy the VHD file C:\HyperVBoot\hyperVBoot.vhd to the USB drive letter assigned as T:
4. 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
|
1 2 |
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.
|
1 2 3 4 |
diskpart
select vdisk file=T:\HyperVBoot.vhd
attach vdisk
exit
|
5. Using BCDBOOT tool
Use the BCDBOOT tool to copy the necessary boot files so that you can boot your USB stick. Run the following command:
|
1 |
BCDBOOT Z:\windows /s T:
|
6. Removing Paging file from USB flash drive
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:
|
1 2 3 4 |
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:
|
1 2 3 4 |
Diskpart
select vdisk file=T:\HyperVBoot.vhd
detach vdisk
exit
|
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:
http://aka.ms/dlhv2012
WAIK for Windows 7:
http://www.microsoft.com/en-in/download/details.aspx?id=5753
Have any questions?
Leave a comment below!
Backing up Hyper-V
We hope you found this series useful. If you’d like to back up your Hyper-V environment, check out our free backup for Hyper-V which backs up 2 VMs for free. Need more? Download a 30-day trial of our Unlimited Edition: http://www.altaro.com/hyper-v-backup/







15 Responses
This site is awesome. So much useful information. I’m a VMware Consultant learning what I can about Hyper-V 3 and SCVMM 2012 SP1. Currently have Hyper-V and SCVMM running on vSphere 5.1 to learn the features of Hyper-V. Runs well but it would be great to run Hyper-V from a USB drive to get a truer experience how Hyper-V performs on native hardware. I’m going to try this article to accomplish that task. The only thing I’m wondering is where to get all the utilities you mention?
Thanks for sharing.
Tom
line 4 has a space “select vdisk file=C:\ HyperVBoot\hyperVBoot.vhd”
also command “select disk <USB Disk number>” did not work? I had to select disk manually
also the whole reg section has spaces that need to be dropped HKLM\” ” no space
Thank you Tom! Appreciate your time for reading this article! Yes, I fixed those and mentioned the links for downloading Hyper-V – 2012 free edition and WAIK for Windows 7.
Thank you! Got me started. After creating two usb hyper-v 2012 sticks I rebooted my esx servers and they became hyper-v 2012 running from usb. This allows me to see native hyper-v performance verses them running as VM’s on ESX while saving my esx config. To run esx all I have to do is shutdown, remove the USB sticks, reboot, and now I’m running ESX again. Thanks for the tip.
More for your readers, I wasn’t sure what functionality I might loose running Hyper-V 2012 vs Server 2012 with role Hyper-V added. As far as I can tell very little, if any. I’m using the RSAT tools to manage Hyper-V 2012 with Hyper-V Manager, Failover Cluster Manager, and SCVMM.
Thanks again. Watching for continued great post from you.
Nirmal:
Item 6 line 1 I’m seeing the r:\windows\system32 et al … I have r: free on my computer but I don’t see where / if I’m supposed to have it mapped.
I’m also having to replace the AMD64 with x86 …
Thanks for your post…
Thanks Jay for the comments! Fixed drive letter in the article!
Hi!
Thanks for the article. I think there’s a small typo on step 6:
REG load HKLM\HyperVRegistry T:\windows\system32\config\system
should probably be: REG load HKLM\HyperVRegistry Z:\windows\system32\config\system
as the letter T: is assigned to the USB disk, not to the mounted vhd file.
Regards
Hi, thanks for the feedback – fixed it!
It won’t work for me. System says that it can’t find any bootable files on USB removable device.
I’m using Kingston DataTraveler Elite 3.0 Transcend drives. I follow the instructions, but it just won’t work.
Hi Srdjan, Thank you for reading the article!
Could you please tell me at which step it fails? It looks like you received the “Can’t find any bootable files” message when you are booting from the USB?
Thanks!
Nirmal
Hello,
Thanks for this great post!
I would like to comment that with Windows 8 and Server 2012, there is no need for WAIK any more. The following included commands are enough (on one line):
1) “dism /apply-image /imagefile:d:\Sources\install.wim /index:1 /applydir::\”.
2) “:\Windows\System32\bcdboot :\Windows /f ALL /s :”
For more boot options: http://technet.microsoft.com/en-us/library/hh825709.aspx
Thanks,
Nadav
On the above comment the commands are cutoff (drive letters are missing). Here are the fixed ones (D is for the install DVD/ISO, T is for the USB and S is for the VHD):
1) “dism /apply-image /imagefile:D:\Sources\install.wim /index:1 /applydir:S:\”.
2) “S:\Windows\System32\bcdboot S:\Windows /f ALL /s T:”
Sorry for that,
Nadav
How do you backup the USB disk? Can we just clone the disk and replace it when the original one die?
Hi Richard, Windows does not have native tool for cloning USB stick but yes there are third-party tools available you can use to clone USB Sticks!
Thanks!
Nirmal
Hi Nadav, Thank you for the commands!
Nirmal