Since Windows 11 has some extra requirements, you’ll need to go through some more steps when making a virtual machine in Hyper-V.
Requirements #
First you should check out the current Windows 11 System Requirements. As of writing the current requirements are:
- UEFI / Secure Boot Enabled (Gen 2 VM)
- TPM 2.0
- 4GB (4096MB) of Memory
- 2 vCPUs
If you don’t meet these requirements, you’ll be met with the following error screen and won’t be able to proceed with the installation:
- These requirements can be bypassed by using an Answer File.
Create the VM #
You can create a Windows 11 VM in Hyper-V either through the GUI or PowerShell.
Option 1: Hyper-V GUI #
- Open Hyper-V Manager.
- Click on “New” > “Virtual Machine”.
- Follow the wizard:
- Name: Give your VM a name.
- Generation: Select “Generation 2”.
- Startup Memory: Set to at least 4096 MB.
- Network: Select a virtual switch if you have one.
- Virtual Hard Disk: Create a new VHDX file (at least 64 GB).
- Installation Options: Choose “Install an operating system from a bootable image file” and select your Windows 11 ISO.
- Click “Finish” to create the VM.
Since the VM is Generation 2, it will automatically enable UEFI and Secure Boot. However we still need to enable a virtual TPM:
- Right-click on the newly created VM and select “Settings”.
- Go to “Security”.
- Check the box for “Enable Trusted Platform Module”.
- Click “OK” to save the settings.
Your final configuration should look similar to the below, with the TPM enabled:
You can now start the VM and proceed with the Windows 11 installation.
Option 2: PowerShell #
Hyper-V VMs can also be created using PowerShell–Hyper-V comes with a module that allows you to perform various management tasks with new and existing VMs.
- Hyper-V Module Documentation on Microsoft Learn
You can repurpose my script function below which will create a VM with the necessary settings for Windows 11 by default:
Download Script<#
.EXAMPLE
./Create-Win11VM.ps1 -VMName 'Test Win11' -ISOPath './Win11_24H2.iso' ` -VHDPath './Test Win11.vhdx' `
-VHDSize 128GB -vCPUs 4 -Memory 16GB
#>
param(
[Parameter(Mandatory)]
[string]$VMName,
[Parameter(Mandatory)]
[string]$VHDPath,
[Parameter(Mandatory)]
[string]$ISOPath,
[uint64]$VHDSize = 64GB,
[Int64]$Memory = 4GB,
[Int64]$vCPUs = 2,
[string]$SwitchName = "Default Switch",
[switch]$StartAfterCreation = $false
)
#region Validate Params
if($null -ne (Get-VM -Name $VMName -ErrorAction SilentlyContinue)){
throw "VM '$VMName' already exists!"
}
if(Test-Path $VHDPath){
throw "Virtual hard drive at path '$VHDPath' already exists!"
}
if(-not (Test-Path $ISOPath)){
throw "Cannot locate the installation media at '$ISOPath'!"
}
#endregion
#region VM Creation
if($null -eq (Get-VMSwitch -Name $SwitchName -ErrorAction SilentlyContinue)){
Write-Output "Creating Virtual Switch '$SwitchName'"
New-VMSwitch -Name $VMName -SwitchType Internal -ErrorAction Stop | out-null
}
$vm = New-VM `
-Generation 2 `
-Name $VMName `
-MemoryStartupBytes $Memory `
-NewVHDPath $VHDPath `
-NewVHDSizeBytes $VHDSize `
-SwitchName $SwitchName `
-Version ((Get-VMHostSupportedVersion -Default).Version)
$InstallMedia = $vm | Add-VMDvdDrive -Path $ISOPath -Passthru -ErrorAction Stop
$vm | Set-VMFirmware -FirstBootDevice $InstallMedia -EnableSecureBoot On
$vm | Set-VMProcessor -Count $vCPUs
## Enable vTPM
$owner = Get-HgsGuardian UntrustedGuardian
$kp = New-HgsKeyProtector -Owner $owner -AllowUntrustedRoot
$vm | Set-VMKeyProtector -KeyProtector $kp.RawData
$vm | Enable-VMTPM
Write-Output "New VM '$VMName' created and prepped for Windows 11 Installation!"
#endregion
#region Start VM
if(-not $StartAfterCreation){ exit 0 }
$vm | Start-VM -Passthru
#endregion
#Requires -RunAsAdministrator
Bypassing Requirements #
If you need to bypass some of the requirements, you can use the following in an Answer File, just mount a virtual drive with the file at the root named autounattend.xml
exactly.
The below answer file will create the necessary registry keys to bypass the TPM, Secure Boot, and RAM checks during installation:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
</unattend>
Article Photo by Sunrise King on Unsplash