Testing a USB Windows Install disk with Hyper-V
Recently I was putting together a new Windows USB Install disk (if you are not familiar with the process for doing this - here is a good article: https://windowsitpro.com/windows-8/q-how-do-i-create-bootable-usb-stick-can-install-uefi-system). I really wanted to use virtual machines to test the disk as I was putting together (I am using unattended installation files and various scripts) however you cannot boot a Hyper-V virtual machine off of a USB key.
So what could I do?
The answer is surprisingly simple. If you setup a virtual hard disk in exactly the same way that you do a USB install disk - you can use it to install Windows.
The process that I followed was to:
- Create a 32GB dynamic VHDX file using Hyper-V
- Mount the VHDX file in the host operating system - and then use DISKPART to create a FAT32 partition on it (that is marked as active), as discussed in the article above
- Copy in the Windows install files (and my custom scripts and tweaks)
- Create a virtual machine with this 32GB VHDX as the first hard disk, and a blank VHDX as the second hard disk
- Boot the virtual machine and install the operating system
This allowed me to quickly and easily test my install scripts. Once I had everything working the way I wanted - I just had to copy my files to a physical USB key and go.
Cheers,
Ben