Setting Up Nested Virtualization on Windows Server 2022 Datacenter
Introduction
This guide walks through setting up nested virtualization on Windows Server 2022 Datacenter. The goal is to enable the 2k22-Host → 2k22-Virtualization → Test VMs architecture, where a host VM can also run virtual machines.
Steps
Step 1: Installing Hyper-V on the Host (2k22-Host)
-
Install Hyper-V using PowerShell:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
-
Verify Installation:
Get-WindowsFeature -Name Hyper-V
Step 2: Create and Configure the Intermediate VM (2k22-Virtualization)
-
Create the Intermediate VM on the host (2k22-Host) using Hyper-V Manager.
-
Expose Virtualization Extensions: Enable nested virtualization so that the intermediate VM can host other VMs:
Set-VMProcessor -VMName "2k22-virtualization" -ExposeVirtualizationExtensions $true
-
Enable MAC Address Spoofing for network connectivity:
Get-VMNetworkAdapter -VMName "2k22-virtualization" | Set-VMNetworkAdapter -MacAddressSpoofing On
-
Activate Windows on the intermediate VM using KMS client keys:
slmgr /ipk W3GNR-8DDXR-2TFRP-H8P33-DV9BG
If required, refer to Microsoft KMS Documentation for more details.
Step 3: Installing Hyper-V on the Intermediate VM
-
Install Hyper-V on 2k22-Virtualization using PowerShell:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
-
Create Nested VMs (such as Windows 10 testbox) within the intermediate VM using Hyper-V Manager.
Additional Considerations
-
GPU Pass-Through (Optional): If GPU pass-through is needed, follow the Easy-GPU-PV Guide.
-
Networking: MAC address spoofing is enabled using:
Get-VMNetworkAdapter -VMName "2k22-virtualization" | Set-VMNetworkAdapter -MacAddressSpoofing On