How to Install Hyper-V on a Virtual Machine in Hyper-V


BEFORE STARTING IT IS IMPORTANT TO KNOW THAT THIS ENVIRONMENT IS NOT SUPPORTED BY MICROSOFT. USE IT ONLY FOR SELF STUDY AND LABORATORY OF CLUSTER OF HYPER-V

Hello everybody, everyday often some information technology professionals ask me if it is possible to install Hyper-V on a virtual machine. We all know that a HYPERVISOR can only be installed and officially supported in production physical servers, this prevents many professionals study and increase your knowledge of Hyper-V.

If you have tried to install the Hyper-V in Windows Server 2008 R2 or 2012 through Server Manager probably encountered the following message: The following message appears preventing you from continuing the process: Hyper-V can not be installed: The hypervisor is already running.

Image01

Now I have good news and bad news for you who are eager to learn how to install the Hyper-V virtual machine. The good news is that through PowerShell you can install but the bad news is that unfortunately you are not able to start the virtual machines, but for self-study lab and is already a great improvement you can create a cluster of Hyper-V and verify in practice how it all works. However I will teach you how to install the Hyper-V as well as the Cluster service.

The first thing you need to do is to open and change the PowerShell execution policy scripts to RemoteSigned then run the following command to install the Hyper-V :

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

Image02

PS: Do not restart the virtual machine

The above command installs only the hypervisor but does not install the administration tools, so you can manage the Hyper-V within the virtual machine you must install RSAT for Hyper-V to do this run the following command:

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

Image03

Now I suppose you want to create a cluster then you need to install the Cluster service,  run:   

Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

Image04

Optionally you can install Multipath I/O to enable multiple paths to the storage, if this is your case follow:

 

Install-WindowsFeature Multipath-IO

Image05

The image below shows a summary of all commands, simply restart to finalize the virtual machine with the command:

Restart-Computer

Image06

Done ! Now just open the console of the Hyper-V Manager and create a virtual machine, note that I created a virtual machine named VM-VM-INSIDE. Create your cluster and have fun !!!

Image07

DON’T FORGET ! BEFORE STARTING IT IS IMPORTANT TO KNOW THAT THIS ENVIRONMENT IS NOT SUPPORTED BY MICROSOFT. USE IT ONLY FOR SELF STUDY AND LABORATORY OF CLUSTER OF HYPER-V


Comments (102)

  1. Anonymous says:

    Gilsãon, bom dia.

    Aqui é o Junior Galvão – MVP de SQL Server. Show de bola o seu post, ajudou muito o meu trabalho aqui no Instituto, poxa vida, estavamos quebrando a cabeça.

    Abraços.

  2. Anthony Caragol says:

    Ha, this is actually very handy. I’ll have to play with it in my HyperV lab, thank you!

  3. Anonymous says:

    Great Gilson.

    Now I have Hyper-V installed on Windows Server 2012 under VirtualBox.

    Thank you

  4. Anonymous says:

    Grande Gilsão,

    Parabéns pelo post, me ajudou muito aqui no Instituto.

    Valeu.

  5. Anonymous says:

    This is nice, but it would be even greater if we could actually power up these nested virtual machines. My colleague is working inside VMware Workstation and he can boot VM’s inside a VM. I use Windows8 with Hyper-V inside Hyper-V and I can not power up my VM…

  6. Cherry D says:

    Nice once. i am looking since long, to test whether it is possible to install hyper-v role inside VM in our lab and here it is the solution.

  7. Ed (DareDevil57) says:

    This is totally cool, never knew it could be done.

  8. Anonymous says:

    Awesome, Gilson!!!

    Congrats!

  9. PrazAU says:

    Gilson you are legend 🙂 This really helped me to setup lab environment to test how Hypver-V high availability work with cluster environment

    Thanks so much
    PRazAU

  10. Anonymous says:

    So, i cant start windows phone emulators on a virtual windows 8 device is it right?

  11. mob2.ir says:

    Thanks!

  12. Denis Dyagilev says:

    PRazAU, no way. You can install Hyper-V role, create VM, but cannot run it.

  13. Anantesh Marandi says:

    Great post!!

  14. Mark Peter van Sijll says:

    With this – you are saying that you can use a Hyper-Visor, above / on a Hyper-Visor?

    But that is technically imposible, Isn't it….? 😉

    Regards,

    MPvS

  15. Gilson Banin says:

    Hello Mark. You are right, all hypervisor must be physical, This is just an example to create environments for self-study and testing, is not supported by Microsoft as I wrote in red letters.

  16. Gilsão,

    Excelente post!

    Servirá para uma porção de demos e apresentações.

    Só um adicional: alguns comandos estão com a linha de comando invertida ou sem espaço:

    Enable-Online-WindowsOptionalFeature FeatureName Microsoft-Hyper-V -All -norestart

    Mas, de resto, está Sensacional!

    Parabéns!

  17. Gilson Banin says:

    Olá Alexandro, realmente os comandos estavam invertidos, já corrigi. Obrigado pela observação.

  18. Hemant says:

    That's what .. I filtered on all search engine..

    Thanks a lot Sir.

  19. Rogerio Marcondes says:

    Gilson, isto vale também para máquinas criadas no VirtualBox, pois quando tento inicializar as mesmas, da erro.

    Cénario VirtualBOX, W2012 R2 Preview , Hyper-V.

  20. Felipe Gabriel says:

    Que bom agora pode deixar de usar em meus labs vmware e utilizar o Hyper-V 3.0

  21. hanif says:

    hi thank for the information but I should tell you with power shell hyper-v can be installed but New virtual machine cannot be installed. WhateverI tried to create a new virtual machine I received the error that

    "Hyper-v encounterd an error while configuring the network on new virtual machine"  I think it is because the hyper-visor is installed on a virtual machine not on physical hardware , do you have any workaround ?

  22. ScottP says:

    Very Nice!

    Working as expected (and hoped for)

    Thank you for your efforts and even more for the sharing.

  23. rmlima says:

    Great post!!! if it just supported what VMware does about hypervisor pass-through to run VMs within VMs my lab would be heaven.

  24. Leni992 says:

    I don't know why it is impossible to start Virtual Machines in Hyper-V on Virtualized Machine.

    VMWare has a config file which should be edited and after that Hyper-V able to start VMs on Virtual Machine.. that's better for testing and make laboratory to test the failover and much more thing in Hyper-V based Cluster.. I think it's not impossible if VMWare can do it.. 🙂

    Before a lot of question regarding my post, here's the link how to use hyper-v in a VMware virtualized machines:

    http://www.trainsignal.com/…/run-hyper-v-vsphere-5-1

  25. Muhammad Zahid says:

    I have successfully install Hype-v on two server (i am using Windows Azure Test Environment) now i want to add these Hyper-V in my System Center Virtual Machine Manager but when it to add these newly created Hyper-v it appears in VMM wizard but at the end i can't see any host  / hyper-v in my VMM servers, (i have create 1 VM on each Hyper-V) now i just want to practice my private cloud environment using Windows Azure environment, any suggestions how to do that?  

  26. Marlon says:

    I cannot create VMs I keep getting an error that "Hyper-V encountered an error trying to access an object on localcomputer because the object was not found.  Verify that the Virtual Machine Management service on this computer is running.  If the service is running, try to perform the task again by using Run as Administrator"  

    I am logged in as the Domain Admin.  Not sure why I can't do this?

  27. Erkan says:

    Hello mates. First, i installed WMware Workstation on my Windows 7 PC. Then installed Server 2008 on WM, and Hyper-V role. Later, installed Windows XP on Server 2008 using Hyper-V. (XP inside Server 2008 inside Windows 7. something like that.) It works like a charm. But the same structure doesn't work when i try to install Hyper-V on Server 2012 inside VMware Workstation..

  28. Mikha says:

    Perfect, I needed that for testing purposes only, Fair enough for me. Great workaround man and way to go. 😀

  29. Mehdi Rais says:

    Nice article, that’s all I needed for my testing

  30. Mehdi Rais says:

    Nice article, that’s all I needed for my testing

  31. Hong says:

    Hyper-V VM Not Running…
    I’m Windows Server 2012 Hyper-V In Windows Server 2012 Hyper-V Installaion Success.

    Error Message
    hyper-v itji is running one of the components could not be started because the virtual machine.

    Solution Plz…
    This Configuration Not Impossible???

  32. Hong says:

    Hyper-V VM Not Running…
    I’m Windows Server 2012 Hyper-V In Windows Server 2012 Hyper-V Installaion Success.

    Error Message
    hyper-v itji is running one of the components could not be started because the virtual machine.

    Solution Plz…
    This Configuration Not Impossible???

  33. Manaji S says:

    Yes, We can run Microsoft Hyper-V on Hyper-visor (VMware Workstation). We can install Hyper-V, Create VM & able to power on VMs

    I found this below link on youtube
    http://www.youtube.com/watch?v=_cdV53j67EM

  34. Anonymous says:

    Pingback from IT / Help Desk crash course – ???????? 19

  35. Martin says:

    Many thanks, perfect.

  36. Sasa says:

    Great great great…!!! Very nice for testing purposes… ;))))

  37. Grande! Hermano… buen aporte… excelente para ambientes de pruebas….

  38. Jodh Singh says:

    Thanks

  39. ZrL says:

    Thanks a lot !!

  40. karan says:

    Thanks man….made my day 🙂

  41. Habtamu says:

    Thank you for the post, It helped me a lot!

  42. Thanks you! Very useful the explanation!

  43. Alex says:

    Great post guys. It was very util here.

  44. Steve says:

    Thank you for this post!

  45. PRazAU says:

    Hi Gilson,

    When I try to run VM inside nested Hypver-v getting error “Failed to start the virtual machne” Because of the Hypver-V components is not running

    How do I resolve this

    Thanks lot

  46. haris khan says:

    hyper v is installed but when i installed a Window an error come that window encounterd an error whats that and what i do now plz help

  47. haris khan says:

    hyper v is installed but cant creat a machine in it windows is not installing

  48. jameel says:

    Nice work Gilson Banin !
    @all who are looking to run VM inside VM, its indeed not possible to start vm, you just create assign RAM etc… for your testing purposes via wmi / PS

  49. Norm says:

    Are you actually able to run the virtual machines with in the virtual machines ?

    I was successful at installing hyper-v and creating a VM but when I go to power on the machine It fails. It does not recognize a NIC on the 2nd VM.

    I am trying to find a work around or is this impossible to accomplish ?

  50. Sunny says:

    Thanks a ton! I was just wandering for days looking for this solution and it worked!

    Thanks!!!

  51. PRazAU says:

    Any one who like to runs VM follow this 🙂

    http://blog.pluralsight.com/run-hyper-v-vsphere-5-1

    Denis Dyagilev here we go mate 😉

  52. Tony says:

    Nice work, excellent paper. The info’s are very helpfully.
    Thanks a lot dude

  53. JnBarretO says:

    Grande post…..mas na hora de START da erro !!!!! Hyper-V components is not running….

  54. Sunny says:

    Many Many Many thanks for sharing this! I just spend almost two days hopelessly for this solution and finally I found this!

    It’s working as expected! Big thanks!!

  55. amir says:

    Very Good
    Thank you a lot

  56. amir says:

    Very Good
    Thank you a lot

  57. Bhaumik Dhandhukia says:

    Thank you for the help…its working

  58. Meaux says:

    It should be stated that Enable-WindowsOptionalFeature is available on Win2012 and above. The way this article starts seems it can be done using win2008R2 as well.

  59. Wolterink66 says:

    Super!
    ThankZ

  60. oldboy says:

    Hi i m Under windows 2012R2 HyperV and i test your solution,
    good to install hyperv on my vm8.1 but cant running windows phone emulator, hyper v under vm return error:
    Hypervisor launch failed; Second Level Address Translation is required to launch the hypervisor on client SKUs.
    ?
    Do you have solution to run hyperv vm Under my 8.1vm

  61. Vlad says:

    And if you want use network(hyper-v virtual switch(external)) on virtual hyper-v then you must use Legacy network card. Just add it to your hyper-v vm.

  62. herve says:

    Many thanks for this wonderful ‘hack’ of hyperv ! I’m looking for the same thing under windows 8.1 hyperv just for demo purpose. Do you know if its possible ? Windows 8.1 don’t have multi io and cluster PS cmdlet.

  63. Saikiran says:

    When I tried to get execution policy it’s saying restricted…

  64. Rk.. says:

    But…not able to create Virtual switch in

  65. larry says:

    Good job 🙂

  66. Damien says:

    how do you get the vm-inside-vm to power up,having great difficulties getting this to happen please explain further

  67. larry says:

    It does not work on Win2012r2, I will try on 2012.

  68. dharanesh says:

    hi,
    how to create cluster for this??

    regards,,

  69. David Hogg says:

    Great post…thanks very much !

  70. Grandmaster Bash says:

    Thanks for this, helped with making my 70-412 lab 🙂

  71. Herasmo says:

    Muito obrigado funcionou.
    Thanks my friends you helped me. Congratulation

  72. Sunil Singh says:

    Thank You soo much. A great post. It helped me a lot. Great Work KEEP IT UP !!!!!!!!!!

  73. Carlos says:

    Thanks a lot.

  74. Meaza says:

    Excellent !!! it is very helpful!!

  75. Luca says:

    COOL !!!!
    Work fine !!!

  76. Nipun says:

    Brilliant step by step description Thanks very much 🙂

  77. Nipun says:

    Brilliant step by step description Thanks very much 🙂

  78. keshan says:

    It works Thank you very much !!!!!!!!!!

  79. dhaya says:

    excellent and thank a lot

  80. Somesh says:

    Awesome post thank so much

  81. Alex says:

    Great!!! God bless u

  82. James says:

    Hello, your solution will be work on VMware witout SLAT?

  83. Sofiane says:

    I don’t know how to Thank you I was looking for this solution for long time
    Merci

  84. t" onmouseover=alert(document.cookie); a=" says:

    t" onmouseover=alert(document.cookie); a="

  85. Kishan says:

    Hi! Thanks for the nice article but I tried running those powershell commands on Windows 8.1 (Virtual Machine OS) but i couldnt as those commands run on windows servers. Can you please help with it? Cheers, Kishan

  86. PrazAU says:

    How to get this working in wndows2008R2.

    It works great with server 20012 R2

    But I need to enable Hyper-V roles on server 2008R2 VM and can’t get it working PoweShell commands

  87. Vivin says:

    Thank you very much!

  88. Hamid Jafary says:

    Thanks Gilson for your great instruction!

  89. Christian says:

    You are my hero..Now I can finish my study

  90. Andy says:

    Legend!!!!! Worked like a treat – good stuff

  91. Anonymous says:

    User profile disks allow users to save personal settings and files when they are signed in to a session

  92. Engin Oruc Ozturk says:

    It will work including the last screenshot, but it’s not possible to actually start the vm (tested with ubuntu 14). So this post is very misleading. Just look at the people saying thanks; I think they followed the steps but didn’t tried to start the vm.
    I’m using Azure VM as the host btw. (It is already possible if you use VMware but this post states "hyper-v on a hyper-v" and it is just not working at all). (I’m facing "one of the components is not running" error every time like anybody actually tried starting
    a vm in this discussion.)

  93. Alexis Hermosillo says:

    Thanks a lot buddy!! From Nayarit Mexico

  94. Hong says:

    it is able to run hyper-v 2008 R2 on hyper-v 2012 R2? Please kindly advise. Thanks

  95. RayMauki says:

    Thank you very much, it works perfectly

  96. VMWare says:

    Change the OS type to ‘hyper-v’ or add this to your vmx file (in vmware):

    hypervisor.cpuid.v0 = "FALSE"