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.

 

UEFI, Generation 2 VM, Windows 7 SP1 and Hyper-V Server 2012 R2 (or Windows 8.1)

With the new features of Hyper-V in Server 2012 R2 one of those is the Generation 2 VM. There is a lot to be said on this topic but here is a caveat when using Gen2 VM’s for systems older then Windows 8 or Server 2012.

Let’s start with a spoiler:

It doesn’t work for Windows 7 SP1!

If you create a VM the first question will be: a Generation 1 or Generation 2 VM

As you can see it cannot be changed…well it can 😉 (see http://blogs.technet.com/b/jhoward/archive/2013/11/06/hyper-v-generation-2-virtual-machines-part-8.aspx and http://blogs.technet.com/b/jhoward/archive/2013/11/14/hyper-v-generation-2-virtual-machines-part-10.aspx)

So you create a Gen2 VM and want to install Windows 7. Well oké, the installation is going fine. UEFI gets recognized. Everything is good. Then comes the restart

Hmm not so good. But this is to be expected. Windows 7 does not support Secure Boot! This will be turned off:

Now we try again and see this:

And here is stays, forever.

In the Hyper-V management console we see a lot of CPU Usage so it is doing something 😉

So WHY is this? Windows 7 DOES support UEFI boot. After a search I found this:

Q: Why doesn’t Microsoft support 64-bit Windows 7 or Windows Server 2008 R2 as a guest operating system in generation 2 virtual machines?


A: Certainly it is true that Windows 7 support UEFI, the first requirement for generation 2 virtual machines. However, Windows 7 has a hardware dependency on a Programmable Interrupt Controller (PIC) which is not present in generation 2 virtual machines. Even if Secure Boot is disabled, an attempt to install Windows 7 will result in an apparent hang at “Starting Windows” shortly after boot, consuming high CPU utilization. A similar effect to this will be seen if attempting a network install from a WDS server which has a Windows 7 era boot PE image – network boot will appear to hang as well. For that reason (along with the keyboard issue in Windows 8 PE) I strongly recommend any WDS server are upgraded to the Windows 8.1 PE boot image.

That is pretty clear, NO Windows 7 Generation 2 VM in Hyper-V!

P.S. DO try this with Windows 8.1 – it is incredibly FAST J