Today we’ll learn how to install and run the Hyper-V role in a virtualized instance of Windows Server 2012. With the advent of VMware Workstation 9, we can finally perform nested virtualization.

Timothy Warner

Timothy Warner is a Microsoft Cloud and Datacenter Management Most Valuable Professional (MVP) who is based in Nashville, TN. Check out his Azure and Windows Server video training at Pluralsight, and feel free to reach out to Tim via Twitter.

Latest posts by Timothy Warner (see all)

Historically, we systems administrators have not been able to run a virtual machine (VM) inside of a virtual machine. However, the release of VMware Workstation 9 finally gives us the ability to perform nested virtualization.

Our goal here is to install and run the Hyper-V server role in an already virtualized instance of Windows Server 2012. We’ll then demonstrate that nested virtualization works by deploying a virtual machine (VMs) inside the “outer” VM.

Set up VMware Workstation ^

  1. Open VMware Workstation and create a new VM by using the Windows Server 2012 template. We will need to make two tweaks to the VM configuration in order to (fully) support Hyper-V Server:
  2. In the Virtual Machine Settings dialog box, enable the Virtualization engine options as shown in the following figure.
    Tweaking VM settings in VMware Workstation
  3. Open the VM’s .VDX configuration file from the VM’s working directory. You can find the working directory by navigating to the Options page in the Virtual Machine Settings dialog box and checking the Working directory field.

Add the following three new entries to the .VDX configuration file to match the following screenshot. VMware configuration files can be opened with any text editor. I’ve given you a picture of my configuration file in the following figure.

  • hypervisor.cpuid.v0 = “FALSE”: This option tricks the Windows Server 2012 into “thinking” it is not running in a virtualized instance
  • mce.enable = “TRUE”: This option enables Machine Check Exception (MCE), which enable the Windows Server 2012 VM to report CPU hardware issues
  • vhv.enable = “TRUE”: This option enables nested virtualization

You should check the Virtually Ghetto blog for a neat post that outlines a whole bunch of undocumented .VDX configuration parameters.

Tweaking the VM configuration file

Tweaking the VM configuration file

Your .VDX file may already have an entry for vhv.enable. If so, then please ensure that you don’t have duplicate entries in the configuration file or your VM will fail to boot and produce the “Dictionary Problem” error. I’ve shown that error in the following screenshot.

Dictionary problem - A duplicate entry in your VDX file produces this error

Dictionary problem - A duplicate entry in your VDX file produces this error.

If you try to install the Hyper-V role in virtualized Windows Server 2012 without enabling nested virtualization, then Windows presents the “hypervisor is already running” error message shown in the following screen capture:

Hyper-V cannot be installed. A hypervisor is already running.

Hyper-V cannot be installed: A hypervisor is already running.

Installing the Hyper-V Server Role ^

Boot up the Windows Server 2012 VM and install the Hyper-V server role. We can do this either graphically via the Server Manager, or by using Windows PowerShell. For instance, we can open an elevated PowerShell prompt and submit the following command to install Hyper-V with its associated management tools.

PS:> Install-WindowsFeature –Name Hyper-V –Restart –IncludeAllSubFeature –IncludeManagementTools

After the “outer” VM restarts, we can fire up the Hyper-V Manager tool and test out the nested virtualization.

Testing Nested Virtualization ^

Open Hyper-V Manager from your Windows Server 2012 VM and click New > Virtual Machine.

Creating a new VM in a Windows Server 2012 VM

Creating a new VM in a Windows Server 2012 Hyper-V VM

The rest of the process should be familiar to any Windows administrator who has used Hyper-V. The following screenshot should serve as proof that we can perform nested virtualization with VMware Workstation 9.

In the screenshot I’m installing a Windows 8 Hyper-V VM inside of a Windows Server 2012 VMware VM, which in turn runs on my Windows 7 hardware host.

Nested virtualization with VMware Workstation - A virtual machine running inside of a virtual machine inside of a hardware host

Nested virtualization with VMware Workstation: A virtual machine running inside of a virtual machine inside of a hardware host.

Conclusion ^

Because VMware Workstation is a desktop application and not an enterprise server product, we certainly aren’t looking to deploy production-quality Hyper-V server boxes from this platform.

However, the ability to perform nested virtualization makes it much easier for administrators and developers to build, test, and rebuild configurations with the least amount of administrative effort.

Are you an IT pro? Apply for membership!

4+
Share
23 Comments
  1. Vladan 7 years ago

    I think that you misspelled the virtual machine configuration file (.VMX) on several parts of your article.

    The possibility to run nested hypervisors is quite cool. Having full VMware vSphere lab running on a laptop (in nested VMs) is even more exciting, for demos and lab testing while on the go. You can check out my post on that: http://www.vladan.fr/nested-lab/

    Best
    Vladan

    3+

  2. Matt 7 years ago

    Thanks for this, I can confirm it also runs in vmware Fusion 5.0.2 for Mac.

    1+

  3. Tomson 7 years ago

    Hi. Do you have any idea how can I run Hyper-V on Windows 2008 Server Virtual Machine nested in VMware Workstation9?

    2+

  4. Andrea 6 years ago

    Thanks for your article.
    To me it looks useful for "labs on a laptop". If you setup hv on a laptop, you lose all the "laptop features" (Bluetooth, etc.). This allows you to retain your fully-featured client os plus experiment w/hv!

    2+

  5. unx 6 years ago

    With VMware Workstation 9 instead of editing the .vmx file you can change the Operating System to Hyper-V (unsupported). This allows you to use nested virtualization too.

    2+

  6. ben 6 years ago

    i have found this quite impossible. i am trying to set up a lab using vmware workstation 10. Actually trying to recreate the lab environment greg shield created in his cbt nuggets 70-247 video series. Everything i have done seem not to work. when i add the hyper-v server host to VMM, windows server 2012 refuses to boot up

    3+

  7. Ilya 4 years ago

    Will this also work for nested Hyper-V 2008 R2? Your tutorial is for 2012.

    0

  8. Evandro Semedo 4 years ago

    Performed this process in vmware workstation 12 and then it turns off and starts physical machine, the vm running hyper-v on vmware workstation 12 starts with blue screen.

    2+

  9. Evandro Semedo 4 years ago

    Solution for Blue Screen about building Hyper-V Servers on VMware Workstation

    https://itcooks.wordpress.com/2015/02/16/vmm-tips-tricks-multipath-io-issue-after-adding-hyper-v-hosts-to-scvmm/

    2+

  10. Ramanathan 4 years ago

    Hi,

    Many Thanks for the help!!

    It works Perfectly.

    2+

  11. Phil 4 years ago

    I'm using a nesting szenario with w2k12r2 + 8.1 clients.
    Fusion(Workstation for Mac)->W2k12R2 Hyper-V
    - W2k12R2 testserver (DHCP, DNS, AD, ....)
    - w8.1 testclient

    If I just use non-UEFI(gen1) guest all things which I test will run. NIC Performance == 10Mbit.
    If I use UEFI(gen2) guest for better NIC performance it will not work.

    MS says nesting will be an official feature of the w2k16.

    2+

    • Author
      Timothy Warner 3 years ago

      Hey Phil. I'm sorry for the delayed response. That's true--Windows Server 2016 and Windows 10 Hyper-V allow you to do nested virtualization. I've been working with the feature in Technical Preview 5 and it works great. Thanks, Tim

      2+

  12. higgins 3 years ago

    is there a 1 to 1 relation between the number of CPUs and the following string?

    hypervisor.cpuid.v0 = “FALSE”

    If I want to add more then 1 CPU to the virtual hypervisor machine, do I need add more lines into the VMX -file?

    hypervisor.cpuid.v1 = “FALSE”

    hypervisor.cpuid.v2 = “FALSE”

    hypervisor.cpuid.v3 = “FALSE”

    etc.

    3+

    • Author
      Timothy Warner 3 years ago

      I've never tried it, but it sounds reasonable. Have you enabled 2 virtual CPUs in the VM, added the line to the .vmx file, and verified? I'd be interested to know. Thanks, Tim

      1+

  13. Jones 3 years ago

    For the benefit of those starting out,
    In regards of "install win8 hyper-v vm inside of win server 2012 vm,which in turn runs from my win7 host "
    How do i able to get the iso image from the win7 host?how do i link/enable it?

    2+

  14. Steph 3 years ago

    We've been using this setup for Xamarin Android development with Visual Studio 2015 for some time.

    If one runs it on a Linux host, it is terribly slow, as is to be expected. VirtualBox speed is at least somewhat acceptable.

    2+

  15. Gourav Bharti 3 years ago

    thanks ,

    thanks a lot it really helped me i was worried from 2-3 days is it possible but now its working.

     

    thanks to you

    thanks & Regards

    Gourav Bharti

    0

  16. Gibbs 2 years ago

    Thanks for this article!
    Do you also have instructions to get this working on Server 2016?
    I tried this on VMWare workstation running a Server 2012 R2 Datacenter Hyper-V server, this works perfectly. When I try to do the same with Server 2016 Datacenter the server won't boot after installing the Hyper-V role. When I disable "Virtualize Intel VT-x/EPT or ADM-V/RVI" option the server boots again, but then the VM's in Hyper-V won't boot.

    2+

  17. Saman 2 years ago

    Thank you for the help there...searched a lot of blogs to finally reach to this one.

    right now my WS 2012 r2 's hyper-v role is being installed on vmware workstation, and i am happy to say it is working as it should.

    thank you again.

     

    2+

  18. Mojtaba Karimi 2 years ago

    Thanks

    It resolved my problem.

     

    1+

    Users who have LIKED this comment:

    • avatar
  19. Tim 1 year ago

    I have this setup, but my guest client in the Hyper-v doesn't have proper network connection.

    0

  20. Farshad 1 year ago

    Thanks
    That was perfect.

    0

  21. Grotesque 7 months ago

    Thanks,

    works with vmware workstation 14 and Windows Server 2016 Core.

    0

Leave a reply to ben Click here to cancel the reply

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

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account