Creating Nested Hyper-V machines with Windows Server 2016

Save to My DOJO

Creating Nested Hyper-V machines with Windows Server 2016

I know that most of you want to learn virtualization, and since you have Hyper-V in your company this is a very important task. A common problem is that you can’t test on production systems and a lab is out of the question for a company of your size. If this sounds all too familiar but you’re still eager to learn, nested virtualization will help you out tremendously. Now I’m not going to give you a nice and long definition of what nested virtualization is because Andy already has an article about it where he explains it very well; but long story short, nested virtualization lets us create Hyper-V virtual machines inside a Hyper-V virtual machine or Hyper-V host. Think about it, we can have a Hyper-V farm inside a single box. Off course, this will be only for testing purposes, because production environment won’t support this configuration largely due to the performance impact of running such a setup.

In order to be able to create a nested Hyper-V machine with Windows Server 2016, Hyper-V requires hardware virtualization support (such as Intel VT-x) to run virtual machines. In previous Windows Server versions, such as 2012 and 2012 R2, this capability was hidden from the guest VMs which prevents them from running the Hyper-V server role among other hypervisors. In Windows Server 2016 however, Microsoft has given us the choice to enable this processor capability inside a VM using PowerShell.

Before moving forward I presume you have already installed Windows Server 2016 on your host (the bare metal server), as well as the Hyper-V role. Also, make sure in the BIOS of the hardware you have the virtualization support available and enabled.

Create Nested Hyper-V

Now you’ve got that ready, let’s move into creating our first Hyper-V virtual machine.

Creating a Hyper-V nested virtual machine

Open the Hyper-V console and from the Actions pane click New > Virtual Machine;  or right-click the host and follow the same steps.

Create Nested Hyper-V manager

On the first page of the New Virtual Machine Wizard, name the new VM and provide a location for the virtual disk(s) and configuration files.

New virtual Machine Wizard

In the Specify Generation page choose the second option to create a generation 2 virtual machine. This one has better performance and supports the newest features.

Virtual Machine Wizard Generation

Since this will be a Hyper-V host, as far as the virtual machines that will run on it know, we will have to allocate a fair chunk of memory. Based on how much RAM you have on your physical server and how many VMs you want to run on this Hyper-V virtual machine, assign the right amount. Ensure that Use Dynamic Memory for this virtual machine is not selected then click Next.

Virtual Machine Wizard Assign memory

Select the virtual switch you want this virtual machine to be connected to then continue the wizard.

Create Nested Hyper-V networking

Provide the path for the virtual disk then the size of it. If you intend to keep and run the virtual machines on this disk, make it big, if not use the appropriate size just for the OS.

Create Nested Hyper-V virtual hard disk

Choose how you want to install the OS then click Next. This settings can be also configured alter on.

Create Nested Hyper-V installation

Click Finish to create our first virtual machine soon to be a Hyper-V virtual machine.

Create Nested Hyper-V wizard

Once created, power on the VM and install Windows Server 2016. I’m not going to put the installation steps here which consist simply of just booting from the network and doing a few clicks on the installation wizard.

hyper-v manager

Once you get it up and running and try to install Hyper-V on the virtual machine an error will be presented:

Hyper-V cannot be installed: the processor does not have required virtualization capabilities.

virtual machine connection

The message pops-up because, by default, the hypervisor hides the hardware virtualization support capability from guest VMs. The next steps are to use some PowerShell command lines to enable virtualization support capability for guest VMs. Shut down the virtual machine then execute the commands shown below. The first one lets you see if virtualization support is enabled for the VM, and the second one enables virtualization support. The problem about running the second command line is that no message is displayed if it succeeds.

Get-VMProcessor -VMName <Target VM's name> | fl *
Set-VMProcessor -VMName <Target VM's Name> -ExposeVirtualizationExtensions $true

windows powershell administrator

In case you want to speed things up and try to enable virtualization support while the virtual machine is still running, you will get an ugly error message in PowerShell; so make sure the VM is off.

Set-VMProcessor : Failed to modify device ‘Processor’. Cannot change the processor functionality of a virtual machine now.
“…” Cannot change the processor functionality of virtual machine ‘Server-HV01’ while it is running.

windows powershell administrator

Now power on the virtual machine and try installing Hyper-V. The wizard should let us install the role this time with no problems whatsoever.

Create Nested Hyper-V server roles

I’ve seen people perform a second layer of virtualization, meaning inside this Hyper-V virtual machine they deployed another Hyper-V VM and only then they will start creating the required test machines. You can do that, but I don’t recommend it, because the performance rapidly declines and if you think about it, you don’t even need to. If the test you are doing requires another Hyper-V VM, all you need to do is follow the above steps and create another Hyper-V virtual machine on the bare metal hypervisor.

Create Nested Hyper-V manager

Creating virtual machines inside the nested hypervisor

Once you’re done creating your nested Hyper-V machines, open the console for one of them and start creating virtual machines like you would normally do except now your virtual machines will run inside a virtualized Hyper-V server. Pretty neat, huh??

Create Nested Hyper-V virtual machine connection

As you can see they are running smoothly and if you can afford an SSD drive they will run great.

Create Nested Hyper-V administrator

Now I’ve told you how to create Hyper-V nested virtualization here comes the disclaimer because you’ll quickly find out there are a few features that won’t work. To be honest, I don’t know if it’s such a problem missing these because you are probably not going to make use of them in a test lab anyway. Here they are:

  • Checkpoints are not going to work
  • Live migration is not going to work
  • Live memory resize is not possible. You will have shut down the Hyper-V VM.
  • Does not currently run with AMD processors. <This is the biggest drawback I can find>


Nested virtualization in Windows Server 2016 brings a new level to virtualization with Hyper-V that is perfect for creating lab environments and learning all there is about Microsoft technologies. I have to say, the feature was implemented very late compared to the competition, and the restriction on AMD processors can be a severe issue for some. However, if the drawbacks don’t affect you it’s a really useful tool, and we should expect some improvements from Microsoft in future updates. Until then, use it as it is and comment below with your own experiences!


Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

17 thoughts on "Creating Nested Hyper-V machines with Windows Server 2016"

  • Juri says:

    Hi Adrian

    Thanks for the great post.
    Would you happen to know by when Microsoft is planning to allow Checkpoints also on nested Hyper-V hosts?

    Windows 10 Creators update already got it (

    Thanks again for your help.


  • Any powershell experts out there that is able to enable nested virtualization in that particular a host so that i do not have to always define a named instance after every vm creation?

  • BenGillam says:

    Thanks for the post, just to clarify if you mean live migration does not function full stop or you can’t migrate between levels of virtualisation?

    So if I wanted to play around with it I would need to physical hyper-v hosts to do it?

    • Zoran says:

      Hi Ben,
      When using nested virtualization it is not possible to live migrate the VM which is hosting the nested environment, this is usually the VM running on the physical hardware. The virtualized VMs running inside the guest VM can be live migrated.

      So you can set up a full nested virtualization test environment within a single VM on a single host simulate a live migration.

      Generally you will only use nested virtualization for test/lab/demo scenarios.

      Symon Perriman
      Altaro Editor

  • Courtney says:

    You state “Shut down the virtual machine then execute the command below” but you don’t say where to execute the command. I’m assuming on the host (hypervisor) but no matter what I type I get – Get-VMProcessor : A parameter cannot be found that matches parameter name…. I’ve tried both the actual host name and the name in Hyper V Manager.

    • Zoran says:

      Hi Courtney,
      For this step, you will shut down the guest VM so that you can test/configure these (virtualized) hardware settings. You will then get the VM settings (Get-VMProcessor) from the guest VM which you have just shut down.

      For example, if your guest VM is called “YourGuestVM”, you would run the follow cmdlets:

      PS > Get-VMProcessor -VMName YourGuestVM | fl *
      PS > Get-VMProcessor -VMName YourGuestVM -ExposeVirtualizationExtensions $true

      Symon Perriman
      Altaro Editor

  • Courtney says:

    Huge waste of time and doesn’t work, instead this takes 10 seconds and is run on the VM while it is up.

    Open Powershell in your virtual machine and run the following two commands and then restart your VM.

    Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

    Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature

    • Zoran says:

      Hi Courtney,

      Thanks for the comments. While it is possible to create a VM within another VM without following the additional steps in this blog, it does not behave like a normal VM. For example, there are limitations on starting, migrating and adjusting memory of the VM unless nested virtualization if configured properly. If these components are not needed for your test lab, then the shorter commands that you offer will work and enable Hyper-V in the guest, but most users will want to configure the test environment to behave as closely as possible to production, so the extra steps to configure nested virtualization are needed.

      Symon Perriman
      Altaro Editor

    • Chandrashekhar Gupta says:

      Awesome! I am trying to enable nested virtualization by installing Hyper-V on a new VM with Generation -2 vhdx and it gives me error that not able to install Hyper-v because the processor does not have required capabilities . I tried the command set-vmprocessor but it gives error . So I tried the following commands

      Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

      Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature

      and It worked thanks to Courtney greate work!

      Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

      Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature

      Chandrashekhar Gupta
      CCNP, CCNA Routing and Switching , MCSA, MCTS, MCSA Messaging MCP

    • Chandra Shekhar Gupta says:

      Yes , It Works!!!

Leave a comment or ask a question

Your email address will not be published. Required fields are marked *

Your email address will not be published. Required fields are marked *

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.