Expose virtualization extensions to Hyper-V Virtual Machine

HOW-TO: Expose virtualization extensions to Hyper-V Virtual Machine

In the current world of virtualization it is possible to run Virtualization solutions inside a virtual machine.

So it is possible to run Hyper-V inside a Hyper-V virtual machine, or maybe you want to play around with one of the competitors like VMware ESX of Citrix Hyperviser (the former XenServer!). Microsoft, of course does not support these OSes, but you can always try 🙂

To do so you need a PowerShell line, because it is not (yet) possible for the GUI.

From the Microsoft Docs pages (VERY good info there!) you find the Prerequisites:

Prerequisites

  • The Hyper-V host and guest must both be Windows Server 2016/Windows 10 Anniversary Update or later.
  • VM configuration version 8.0 or greater.
  • An Intel processor with VT-x and EPT technology — nesting is currently Intel-only.

To enable Nested Virtualization use:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true

To disable Nested Virtualization use:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $false

And because it is PowerShell you can do nice things in scripts for instance,

Get-VM | where state -eq ‘Off’ | Set-VMProcessor -ExposeVirtualizationExtensions $true

This enables the virtulization extension on all virtual machines which do not have it enabeld already.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.