Setting up a Hyper-V test lab doesn’t have to be complicated, but I see many people struggling with it. In this post, I’ll share what I do to create lab environments—starting with how to build a parent Hyper-V VM image that serves as the base for multiple virtual machines using differencing disks.
My goal is to run a full-featured lab on a laptop, without needing massive storage. This can be tricky, especially when testing scenarios like Autopatch multi-phase feature update rollouts. To save space, I rely on Hyper-V differencing disks.
What are differencing disks?
Differencing disks are virtual hard disks that store only the changes made from a parent (master) disk. For example, you can create a single “parent” Windows OS disk (about 13GB) and then generate multiple “child” disks that only record differences from the parent. This is especially useful when you need to spin up 10–20 VMs for testing.

More info: Using differencing disks | Microsoft Learn
Assuming you think this is a good idea, you’re probably wondering how to create that first base operating system image. Sure, you could just spin up a new VM, mount an ISO, go through the process of setting up the device, and then run Sysprep to generalize the image. That works, but takes a long time, increases the VHDX size, and can have unintended consequences down the line if you forget what changes you’ve made.
You can do that if you want to, but I think I have an easier way to share with you.
Script a Parent Disk
Rather than manually building out the parent VHDX by installing the OS manually and running Sysprep, you can just run a script to build the parent disk for you from an operating system ISO file. The whole process only takes about 10 minutes and you’re all set with a parent VHDX ready to create child VMs at OOBE.
Here’s how to do it.
Get the script
First, you’ll need to go grab the Convert-WindowsImage script. According to the GitHub ReadMe, the Convert-WindowsImage creates a bootable VHD(X) based on Windows 7,8, 10, 11 or Windows Server 2012, 2012R2, 2016, 2019, 2022 installation media.
Yep, that’s what we need.
Get yourself an Enterprise Edition ISO
Of course, you’re also going to need an operating system ISO to get started. One way to get one is to download it from your organization’s Visual Studio subscription and you’re ready to go. It might be a few months behind on updates but will get the job done.
If you would rather build your own, you can just download a free public one from Microsoft from the Download Windows 11 website by clicking the link under Download Windows 11 Disk Image (ISO) for x64 devices. The only issue with that option is that, by default, it will download Windows Pro edition and it’s also most likely going to be a few updates behind. The good news is that you can use that same link to get what you need to build yourself an up-to-date Windows Enterprise edition ISO.
Go to that same page, and click Download Now under Create Windows 11 Installation Media. That link should provide you with the Windows media Creation Tool (MediaCreationTool.exe). Open up an administrator PowerShell console at the download location and run this command:
.\MediaCreationTool.exe /Eula Accept /Retail /MediaArch x64 /MediaEdition Enterprise
That will tell the media creation tool that you want to download an Enterprise edition (instead of Pro) and in whatever language your system is currently running. If you need a different language you can add the /MediaLangCode <language code goes here> command line option.
The Media Creation Tool will launch and soon prompt you for a key. Feel free to use the Windows 11 Enterprise generic volume license key: NPPR9-FWDCX-D2C8J-H872K-2YT43 (no this will not actually activate Windows). Complete the remaining steps to easily download a fully up-to-date Windows 11 Enterprise ISO around 5.61GB in size.
Create a local directory to host all the goodies and put the Convert-WindowsImage.ps1 script and the operating system ISO you downloaded into it (I named the ISO for this example Win11_25H2_en-us_x64.iso). All that’s left is to build the command line you want to use.
Command Line Parameters
The script offers many parameters to help you customize your parent VHDX without ever logging into the VM. While I prefer to keep things simple, you have the flexibility to do additional things like add drivers to the image, inject an unattend.xml file (for automating Windows setup), enable or disable specific Windows features, apply updates or patches, and more. For a complete list of parameters and advanced usage, check the script’s readme file.
I don’t need anything fancy for my testing usually, so I tend to stick to the basics for my Hyper-V lab machines and only use a few of the available parameters:
- SourcePath
- Edition
- Size
- DiskLayou
- VHDPath
SourcePath Parameter
This is pretty much what it sounds like—where’s the ISO you want to use? Since I put everything in the same folder that the PowerShell console runs in, I just put a .\ in front of the ISO name for this. You’ll end up with something like this:
-SourcePath .\Win11_25H2_en-us_x64.iso
Edition Parameter
If you’re using a multi-edition ISO you’ll need to specify which edition you want to use for your VHDX. Usually you can just check the WIM file for what editions are available on the ISO, but the enterprise edition ISO files download using the media creation tool don’t have one of those. Luckily, you can query the install.esd file to find out. Just mount the ISO (to the D: in this example) and run the following command to get the editions available:
dism.exe /Get-WimInfo /WimFile:D:\sources\install.esd
You should see something like this:

So looks like we’re after index 3 (Windows 11 Enterprise). Un-mount the ISO and let’s move on. We can now add this to the command line (to install Windows 11 Enterprise):
-Edition 3
Package Parameter
This is one of those optional things that everyone is going to have an opinion about.
A fully up-to-date ISO downloaded using the media creation tool doesn’t need this, but I think it’s worth mentioning here as it comes in handy if you’ve got an older ISO hanging around and want to create an up-to-date master disk using it.
It’s easy to do, just download the .MSU you want to apply and provide it on the final command line like so -Package <some .msu file location>.
You should be forewarned, this will over double your VHDX in size, but if you’re creating a lot of VMs you’ll save an average of about 100GB of storage per every 10 VMs that would otherwise need to install the update. At least according to the back of the napkin math I did when I tested it this, but your mileage may vary.
Size Parameter
Size matters when testing feature updates, so make sure you take that into account. By default, the script will create VMs maxed out at 40GB. The VM won’t take up the full 40GB at first, but it could dynamically expand to that. Since feature updates cause VHDX’s to grow quite a bit, I allow the VMs to dynamically expand to the Hyper-V default of 127GB. They’ll probably never get that big before I delete them, but the extra space is nice to have if I need it. Which adds this to the command line:
-Size 127GB
DiskLayout Parameter
This parameter specifies whether to build the image for BIOS (MBR), UEFI (GPT), or WindowsToGo (MBR). Generation 2 VMs require UEFI (GPT) images. You also don’t need to provide a VHDFormat parameter when using UEFI because a VHDX will automatically be created when that’s used. So now we need to add this to the command line:
-DiskLayout UEFI
VHDPath Parameter
The name and path of the Virtual Hard Disk to create. If you don’t specify this parameter, the VHDX will be created in the directory where the script is run, which is fine, but it will also have a crazy name so I always provide this. Here’s the next addition to the command line:
-VHDPath .\Win11_25H2_en-us_x64.vhdx
The full command line
Finally, we can put everything we’ve talked about so far together (plus any extras you’ve decided you need from the ReadMe) into the full command line to use. Here’s what we’ve ended up with:
Convert-WindowsImage -SourcePath .\Win11_25H2_en-us_x64.iso -Edition 3 -Size 127GB -DiskLayout UEFI -VHDPath .\Win11_25H2_en-us_x64.vhdx
Time to make the VHDX
Open a PowerShell console window as Administrator and navigate to the folder with all the goodies in it. You’ve got the bits and the command line so we can just go for it now right? Nope. Go ahead and try it, nothing is going to happen. Why? Because you haven’t clued your PowerShell session in on the function you’re trying to call. That’s right, you’re not actually running the script here, you’re calling a function in the script that’s named the same as the script itself. I know right?
Anyhoo, in your Administrative PowerShell console window, dot-source the script to pull in its functions like so (note the space between the .’s):
. .\Convert-WindowsImage.ps1
Now that the script’s functions are available, you can get to business with that fancy command line of yours (no .\ needed here because you’re calling a function and not a script):
Convert-WindowsImage -SourcePath .\Win11_25H2_en-us_x64.iso -Edition 3 -Size 127GB -DiskLayout UEFI -VHDPath .\Win11_25H2_en-us_x64.vhdx
Hit Enter and watch the magic happen. The script will mount your ISO, find the edition you’ve specified and create a fully patched parent VHDX for you to use as a parent for its multitudes of child differencing disks soon to be available in your Hyper-V labs. The process takes about 10 minutes, but as Alton Brown says, “your patience will be rewarded”.
When the process is completed, you’ll be the proud parent of a new, fully patched VHDX parent disk. Make sure you mark it Read-Only before copying it to wherever it will live. I generally copy the parent disk to the default location set up in Hyper-V for storing hard disk files (C:\ProgramData\Microsoft\Windows\Virtual Hard Disks). That makes it easy to find again later.
Child VM Creation
The next time you need to create a VM using the Hyper-V Manager’s New VM Wizard, just go through the flow, but DO NOT add a hard disk. Choose the option to add a disk later and complete creating the VM.

Once the VM is set up, go back into settings and add a new virtual hard disk. Choose Differencing and browse to your read-only parent VHDX file when prompted.

You can do that as many times as you want to create child VMs, but it’s kind of a PITA making them all one at a time. That’s going to keep you busy for a bit when creating 10-20 VMs.
Scripting the creation of a new family of child VMs using differencing disks based on your shiny new parent disk is easy to do, but that’s another post: Create Hyper-V VMs the easy way.
You’ve seen my blog; want to follow me on socials? @JeffGilb Jeff Gilbert | LinkedIn
![]()