Systems Admin

Configure Nested Virtualization on Hyper-V

Overview

Nested virtualization allows you to run Hyper-V inside a Hyper-V virtual machine. The guest VM acts as a hypervisor and can create and manage its own virtual machines, just like the physical host. This capability is essential for lab environments where you want to test Hyper-V features, practice VM management, or simulate multi-tier infrastructure without dedicating additional physical hardware. It is also widely used in DevOps pipelines, training environments, and testing Windows Server roles that depend on virtualization.

By default, a Hyper-V VM does not expose virtualization extensions to its guest operating system. Attempting to install the Hyper-V role inside a VM without first enabling nested virtualization results in an error. This guide demonstrates the complete process: setting up VMs on a physical Hyper-V host, encountering the virtualization error, enabling nested virtualization via a single PowerShell command on the physical host, and successfully installing and verifying the Hyper-V role inside the guest VM.

Step 1 – Prepare the Hyper-V Environment

This guide assumes the Hyper-V role is already installed on the physical Windows Server host. Open Hyper-V Manager on the physical server to confirm that your virtual machines are created and visible. For this example, the environment includes a VM named NYC-SVR1 along with other VMs (NYC-DC1, NYC-SVR2, and others). NYC-SVR1 will be the VM that runs the nested Hyper-V instance. In Hyper-V Manager, right-click NYC-SVR1 and click Connect to open the VM console.

Hyper-V Manager on the physical server showing a list of virtual machines including NYC-SVR1, NYC-DC1, and others, with the NYC-SVR1 context menu open showing Connect highlighted, and the Server Manager inside the connected VM with the Add Roles and Features wizard open
Open Hyper-V Manager on the physical host, connect to NYC-SVR1, then open Server Manager inside the VM and launch Add Roles and Features to begin the Hyper-V role installation attempt

Step 2 – Attempt to Install Hyper-V on the VM (The Error)

Inside the NYC-SVR1 VM, open Server Manager and launch Add Roles and Features. Proceed through the wizard: select Role-based installation, select the local server, and on the Server Roles page, scroll down and check Hyper-V. Add the required features when prompted and continue through the wizard pages. When you reach the Confirmation page and click Install, you will encounter an error – the Hyper-V role cannot be installed because the VM’s processor does not have virtualization extensions exposed by the host hypervisor.

Add Roles and Features wizard on the Server Roles page inside the NYC-SVR1 VM with Hyper-V checked, and an error message appearing during installation indicating that the processor does not have the required virtualization capabilities
Checking Hyper-V inside the VM proceeds normally until installation begins, at which point an error appears because the physical host has not yet exposed virtualization extensions to this VM

Step 3 – Shut Down the VM and Enable Nested Virtualization

To resolve the error, the VM must be shut down (not just paused or saved). From inside the VM, open the Start menu and shut down. Wait for Hyper-V Manager on the physical host to show the VM status as Off.

Next, open PowerShell as Administrator on the physical Hyper-V host (not inside the VM). Run the following command, replacing the VM name with your VM’s exact name as it appears in Hyper-V Manager:

Set-VMProcessor -VMName "NYC-SVR1" -ExposeVirtualizationExtensions True

This command instructs the physical hypervisor to expose its virtualization extensions to the processor seen by the guest VM. The command completes with no output on success. The VM must remain off while this command runs.

Server Manager on the physical host showing the Hyper-V dashboard with NYC-SVR1 in a shut down state, and a PowerShell window on the physical host with the Set-VMProcessor command entered and completed successfully
Shut down the VM before running Set-VMProcessor on the physical host – the command must be run from the physical Hyper-V server, not from inside the VM, and the VM must be fully off for the change to take effect

Step 4 – Restart the VM and Install Hyper-V

With nested virtualization enabled, start NYC-SVR1 from Hyper-V Manager. Connect to the VM and open Server Manager again. Launch Add Roles and Features and proceed through the wizard exactly as before: Role-based installation, select the local server, and check Hyper-V on the Server Roles page. This time, the role is accepted without error. Continue through the wizard pages. On the Create Virtual Switches page, configure virtual switches for the nested VMs if required, or skip and configure them later. Click Next.

Add Roles and Features wizard inside NYC-SVR1 with Hyper-V checked and no error appearing this time, and the Virtual Switches configuration page showing the available network adapters for creating a virtual switch for the nested VM environment
After enabling virtualization extensions, the Hyper-V role installs without error – proceed through the wizard pages including the Virtual Switches and Migration settings pages

Step 5 – Configure Migration and Default Stores

The Add Roles and Features wizard presents two additional Hyper-V configuration pages before the confirmation screen. On the Virtual Machine Migration page, configure live migration settings if this nested Hyper-V instance will participate in a failover cluster. For a standalone lab VM, leave the default settings and click Next. On the Default Stores page, set the default locations where virtual hard disk (.vhdx) files and VM configuration files will be stored on the NYC-SVR1 disk. Set these to paths with sufficient free space. Click Next to proceed to the Confirmation page.

Add Roles and Features wizard Virtual Machine Migration page with default settings and Next highlighted, and the Default Stores page showing the Virtual Hard Disks and Virtual Machines default folder path fields with the Next button highlighted
Configure default storage paths for the nested Hyper-V instance – for a lab environment the defaults are acceptable, but for any production or persistent use, point them to a drive with adequate free space

Step 6 – Install and Confirm

On the Confirmation page, review the list of roles and features to be installed: Hyper-V and Hyper-V Management Tools should both be listed. Click Install. The installation progress bar runs. Unlike the first attempt, no error appears. The wizard completes successfully with a message confirming the Hyper-V role is installed. The server may prompt for a restart – restart the NYC-SVR1 VM to complete installation.

Add Roles and Features wizard Confirmation page listing Hyper-V and Hyper-V Management Tools to be installed, and the Installation Progress page showing Hyper-V installed successfully with a green checkmark and no errors
The Hyper-V role installs successfully this time – the wizard completes without error and confirms both the Hyper-V role and management tools are installed on the nested VM

Step 7 – Verify Nested Hyper-V

After the installation completes (and the VM restarts if required), verify that the Hyper-V role is functioning inside the nested VM. From Server Manager inside NYC-SVR1, click Tools in the top-right corner. Hyper-V Manager appears in the Tools dropdown, confirming the role is installed and the management console is available. Click Hyper-V Manager to open it. The console shows the NYC-SVR1 server node in the left pane, confirming that this VM is now a functioning Hyper-V host capable of creating and managing its own virtual machines.

Server Manager inside the NYC-SVR1 VM with the Tools menu open and Hyper-V Manager visible in the list, and the Hyper-V Manager console open showing the NYC-SVR1 node in the left pane confirming nested virtualization is active and functional
Hyper-V Manager appears in the Tools menu and opens successfully inside the nested VM – NYC-SVR1 is now a functioning nested Hyper-V host and can create its own virtual machines

Best Practices and Considerations

  • Processor Compatibility – Nested virtualization requires that the physical host’s processor supports virtualization extensions (Intel VT-x or AMD-V). Most modern server-class processors do. However, not all cloud providers expose these extensions to their VMs – check your provider’s documentation before attempting nested virtualization on cloud-hosted Hyper-V
  • Performance Overhead – Nested virtualization adds a layer of abstraction, which carries CPU and memory overhead compared to bare-metal virtualization. For lab and testing purposes this is acceptable, but do not use nested Hyper-V for production workloads where performance is critical
  • Memory Allocation – Allocate sufficient RAM to the outer VM (NYC-SVR1) to support both its own operating system and the memory requirements of the VMs it will host. A practical minimum for a useful nested Hyper-V lab is 8-16 GB assigned to the outer VM
  • The VM Must Be Off – The Set-VMProcessor -ExposeVirtualizationExtensions True command only works when the VM is in the Off state. Running it against a running or saved VM will produce an error. Always shut down the VM completely before running the command
  • Use Generation 2 VMs When Possible – Generation 2 VMs provide UEFI firmware and better performance for nested scenarios compared to Generation 1. When creating the outer VM that will host nested Hyper-V, prefer Generation 2 if the guest OS supports it

Leave a Reply