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: