In this post, I’ll show you how to enable nested virtualization on Windows Server or Windows 11. Nested virtualization allows you to run a Hyper-V host inside a virtual machine. There are a few steps required to set this up, and we’ll walk through them together.
Step 1
Store your physical Hyper-V host name in a variable.
$VMHost = 'Hyper-V-Host'
Step 2
Enable the Virtualization Extensions.
Set-VMProcessor -VMName $VMHost -ExposeVirtualizationExtensions $true
Step 3
Enable MAC Address Spoofing on the Hyper-V Host.
Get-VMNetworkAdapter $VMHost | Set-VMNetworkAdapter -MacAddressSpoofing On
Step 4 (recommended)
Disable Dynamic Memory.
Get-VM -VMName $VMHost | Set-VMMemory -DynamicMemoryEnabled $false
Step 5 (recommended)
Remove all existing snapshots.
Get-VM -VMName $VMHost | Get-VMSnapshot | Remove-VMSnapshot
Step 6 (recommended)
Turn off the snapshot feature.
Get-VM -VMName $VMHost | Set-VM -CheckpointType Disabled -AutomaticStartAction Nothing -AutomaticStopAction
ShutDown
Mission accomplished. Now you are ready to set up a hyper-host in a vm.
Categories: PowerShell, Windows Server



