Save to My DOJO
Q: How Do I Enable Nested Virtualization for Hyper-V Virtual Machines
A: Pass $true for Set-VMProcessor’s “ExposeVirtualizationExtensions” parameter
In its absolute simplest form:
Set-VMProcessor <VMName> -ExposeVirtualizationExtensions $true
Set-VMProcessor has several other parameters which you can view in its online help.
As shown above, the first parameter is positional, meaning that it guesses that I supplied a virtual machine’s name because it’s in the first slot and I didn’t tell it otherwise. For interactive work, that’s fine. In scripting, try to always fully-qualify every parameter so that you and other maintainers don’t need to guess:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
The Set-VMProcessor cmdlet also accepts pipeline input. Therefore, you can do things like:
Get-VM | ? State -eq 'Off' | Set-VMProcessor -ExposeVirtualizationExtensions $true
Requirements for Nested Virtualization
In order for nested virtualization to work, you must meet all of the following:
- The Hyper-V host must be at least the Anniversary Edition version of Windows 10, Windows Server 2016, Hyper-V Server 2016, or Windows Server Semi-Annual Channel
- The Hyper-V host must be using Intel CPUs. AMD is not yet supported
- A virtual machine must be off to have its processor extensions changed
No configuration changes are necessary for the host.
Microsoft only guarantees that you can run Hyper-V nested within Hyper-V. Other hypervisors may work, but you will not receive support either way. You may have mixed results trying to run different versions of Hyper-V. I am unaware of any support statement on this, but I’ve had problems running mismatched levels of major versions.
Memory Changes for Nested Virtual Machines
Be aware that a virtual machine with virtualization extensions exposed will always use its configured value for Startup memory. You cannot use Dynamic Memory, nor can you change the virtual machine’s fixed memory while it is running.
Remember, as always, I’m here to help, so send me any questions you have on this topic using the question form below and I’ll get back to you as soon as I can.
More Hyper-V Quick Tips from Eric:
Hyper-V Quick Tip: How to Choose a Live Migration Performance Solution
Hyper-V Quick Tip: How Many Cluster Networks Should I Use?
Not a DOJO Member yet?
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!
13 thoughts on "Hyper-V Quick Tip: How to Enable Nested Virtualization"
Very informative article on nested virtualisation.
Couple of questions from my end. Could the nested vms be replicated ?
Also what are the options for backup, would you install an instance on the second hyper v host which is a VM?
A nested Hyper-V instance functions the same as a physical Hyper-V instance.
This news is actually VERY interesting.
Might this also mean that the W10 ‘host’ running under Hyper-V (meaning, the primary OS on the computer) might expose the virtualization instructions?
This might finally open some use cases for the Hyper-V hypervisor, namely the possibility to use Hyper-V for Docker for Windows, and at the same time (or even, at the same boot time, meaning without having to restart the machine) another type-2 hypervisor such as VMwaare/VirtualBox might be used.
(This use case is not casual: it is the primary problem preventing me from using Docker on Windows, since I actually use virtual machines most of the time for various developments, and doing so prevents me from using docker when I actually work on Windows).
At this time, I do not believe that this is available. I do know that co-existence with other hypervisors is a top ask, and that Client Hyper-V has been receiving a great deal of development attention. So, not today, but maybe someday.
How to run Oracle Virtual box in Hyper-V Virtual Machine?
Did you get this to work?
I have an HP desktop where I’m running a Hyper-V Server 2019 host and Server 2019 as a VM. In the Server 2019 VM, I am trying to install Hyper-V so that I can use AVMA to activate a few other instances of Server 2019.
My problem is, I cannot seem to install the Hyper-V role on the 1st layer VM. I have verified that VTx and VTd are enabled.
ExposeVirtualizationExtensions is listed as True.
I have also ensured that dynamic memory is disabled and VLAN tagging, MAC address spoofing as well as AllowManagementOS are enabled.
At this point, I have no idea what the issue could be. What are your thoughts?
Run systeminfo.exe as administrator inside the top-layer VM and see what it says for “Hyper-V Requirements”.