How to Configure Nested Virtualization in Hyper-V on Windows 11 Using PowerShell

Nested virtualization allows a Hyper-V guest virtual machine to act as a hypervisor itself, enabling engineers to run Hyper-V, Windows Subsystem for Linux (WSL2), Docker containers, or Kubernetes test clusters directly inside a virtual machine. This capability is essential for developer workstations, continuous integration runners, and security lab environments. In Windows 11, administrators can expose hardware-assisted virtualization extensions (Intel VT-x or AMD-V) to guest VMs using simple PowerShell cmdlets.

Hardware and Software Prerequisites

Before configuring nested virtualization, ensure compatibility:

  • Host OS: Windows 11 Pro, Enterprise, or Education.
  • Processor: Intel Core processor with VT-x/EPT or AMD Ryzen processor with AMD-V/RVI.
  • Hyper-V Feature: Hyper-V role installed and enabled on the Windows 11 host.
  • VM Configuration: The target guest virtual machine must be Generation 2 and powered completely off.

Enabling Virtualization Extensions via PowerShell

Launch PowerShell as Administrator and configure the guest virtual machine:

# Specify the name of your target virtual machine
$VMName = "DevLab-Win11"

# Verify the VM is in an 'Off' state
Get-VM -Name $VMName | Select-Object Name, State

# Expose hardware virtualization extensions to the guest processor
Set-VMProcessor -VMName $VMName -ExposeVirtualizationExtensions $true

# Confirm that virtualization extensions are enabled
(Get-VMProcessor -VMName $VMName).ExposeVirtualizationExtensions

The command returns True, confirming that VT-x/AMD-V instruction sets are passed through to the virtual CPU.

Configuring Virtual Machine Memory and Networking

Nested virtualization requires specific memory and network adapter configurations to operate reliably:

  1. Disable Dynamic Memory: Nested hypervisors cannot dynamically renegotiate memory slices. Assign static RAM:
    # Disable Dynamic Memory and allocate 8GB static RAM
    Set-VMMemory -VMName $VMName -DynamicMemoryEnabled $false -StartupBytes 8GB
  2. Enable MAC Address Spoofing: Nested virtual machines route traffic through the parent VM’s virtual NIC, requiring MAC spoofing:
    # Enable MAC Spoofing on the guest VM network adapter
    Get-VMNetworkAdapter -VMName $VMName | Set-VMNetworkAdapter -MacAddressSpoofing On

Verifying Hyper-V Inside the Guest Virtual Machine

Power on the virtual machine and verify nested support:

# Start the configured VM
Start-VM -Name $VMName

Log in to the guest operating system and open PowerShell as Administrator:

# Query system information inside the guest
systeminfo.exe

Under Hyper-V Requirements, verify that A hypervisor has been detected or all four virtualization extensions display Yes. You can now install Hyper-V, WSL2, or Docker Desktop inside the nested virtual machine without errors.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.