Choosing Between Hyper-V Generation 1 and Generation 2 Virtual Machines
A concise decision guide for selecting Hyper‑V Generation 1 or Generation 2 VMs, including constraints, a comparison table, trade‑offs, a PowerShell creation example, and validation steps.
04 Aug 2026, 01:02 UTC

Decision and Constraints
When deploying a new workload on Hyper‑V, the first decision is whether to create a Generation 1 (Gen1) or Generation 2 (Gen2) virtual machine. Gen2 is the preferred choice for modern operating systems that can use UEFI firmware, Secure Boot, or virtual hard disks larger than 2 TB. Gen1 remains necessary for legacy guest OSes that rely on BIOS‑specific calls, older integration services, or hardware that does not expose UEFI.
Constraints to check before proceeding:
- Hyper‑V host must be Windows Server 2012 R2, Windows 10, Windows 11, or a later version.
- The guest OS must be UEFI‑capable (Windows 8/Server 2012 or later, most modern Linux distributions).
- Sufficient storage for the desired VHDX size (Gen2 supports up to 64 TB).
Options Comparison
| Feature | Generation 1 | Generation 2 |
|---|---|---|
| Firmware | BIOS | UEFI |
| Boot capabilities | Legacy PXE, IDE | HTTP/S boot, SCSI, NVMe |
| Maximum VHDX size | 2 TB | 64 TB |
| Secure Boot | Not supported | Supported |
| Typical Linux support | Limited (older kernels) | Broad (most modern distros) |
Trade‑offs
Generation 2 offers faster boot times, the ability to attach disks larger than 2 TB, and modern security features such as Secure Boot and TPM passthrough. However, some legacy drivers or applications that rely on BIOS interrupts or specific IDE controller behavior may not function correctly in a UEFI environment. Generation 1 provides broader compatibility with older software at the expense of newer features and a lower maximum disk size.
Concrete Implementation: Creating a Generation 2 VM
The following PowerShell script creates a Generation 2 virtual machine named DemoGen2VM with Dynamic Memory enabled, Secure Boot turned on, and a 64 TB VHDX attached. Run the script in an elevated PowerShell session on the Hyper‑V host.
# Variables – adjust as needed
$vmName = 'DemoGen2VM'
$vmPath = 'C:\HyperV\VirtualMachines'
$vhdPath = 'C:\HyperV\VirtualHardDisks\DemoGen2VM.vhdx'
$vhdSizeBytes = 64TB # 64 TB expressed as bytes
# Create the VHDX
New-VHD -Path $vhdPath -SizeBytes $vhdSizeBytes -Dynamic
# Create the VM (Generation 2)
New-VM -Name $vmName -MemoryStartupBytes 2GB -Generation 2 -
-Path $vmPath -VHDPath $vhdPath
# Enable Dynamic Memory
Set-VMMemory -VMName $vmName -DynamicMemoryEnabled $true -
-MinimumBytes 512MB -MaximumBytes 8GB
# Enable Secure Boot (requires UEFI firmware)
Set-VMFirmware -VMName $vmName -EnableSecureBoot On
# Start the VM to verify it boots
Start-VM -Name $vmName
After the script finishes, the VM should be running. No output is guaranteed; the script will create objects or raise errors if prerequisites are not met.
Validation Steps
- Confirm the VM generation:
- Check firmware type and Secure Boot status:
- Verify the attached disk size:
Get-VM -Name $vmName | Format-List Generation
Expected value: Generation : 2
Get-VMFirmware -Name $vmName | Format-List FirmwareType, SecureBootEnabled
Expected values: FirmwareType : Uefi and SecureBootEnabled : True
Get-VHD -Path $vhdPath | Format-List Path, Size
The Size property should show approximately 64 TB (exact value depends on allocation granularity).
Limitations and Practical Checks
- If the guest OS does not support UEFI, the VM will fail to start; verify OS compatibility before creation.
- Secure Boot requires the guest OS to have a valid Microsoft UEFI CA certificate; some custom Linux kernels may need additional configuration.
- When nesting Hyper‑V inside this Gen2 VM, ensure the host CPU exposes virtualization extensions and that nested virtualization is enabled (
Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true). - Dynamic Memory works only with integration services up to date; outdated services can cause time‑sync or shutdown issues.
Rollback (Optional)
Creating a VM changes the host state. To remove the VM and its associated VHDX, run:
Stop-VM -Name $vmName -TurnOff
Remove-VM -Name $vmName -Force
Remove-Item -Path $vhdPath -Force
Verify removal with Get-VM -Name $vmName (should return no results) and confirm the VHDX file is gone.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.