Enabling Nested Virtualization on a VM hosted by Hyper-V
Let's say you have a VM hosted by Hyper-V named CICDSRV01
and we want to enable nested virtualization to run another Docker for Windows instance, we first need to enable this feature by setting ExposeVirtualizationExtensions
to $true
on the target VM's processor
# Check if VM named CICDSRV01 supports nested virtualization
Get-VMProcessor -VMName "CICDSRV01" | Select VMName,Count,ExposeVirtualizationExtensions
VMName Count ExposeVirtualizationExtensions
------ ----- ------------------------------
CICDSRV01 12 False
The ExposeVirtualizationExtensions property reads False so let's enable it
Get-VMProcessor -VMName "CICDSRV01" | Set-VMProcessor -ExposeVirtualizationExtensions $true
Then to verify whether it has properly enabled
Get-VMProcessor -VMName "CICDSRV01" | Select VMName,Count,ExposeVirtualizationExtensions
VMName Count ExposeVirtualizationExtensions
------ ----- ------------------------------
CICDSRV01 12 True
To enable nested virtualization for all machines
Setting
Get-Vm | Get-VMProcessor | Set-VMProcessor -ExposeVirtualizationExtensions $true
Getting
Get-Vm | Get-VMProcessor | Select VMName,Count,ExposeVirtualizationExtensions