Partager via


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

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Ha, this is actually very handy. I'll have to play with it in my HyperV lab, thank you!

  • Anonymous
    January 01, 2003
    Great Gilson.Now I have Hyper-V installed on Windows Server 2012 under VirtualBox.Thank you

  • Anonymous
    January 01, 2003
    Grande Gilsão,Parabéns pelo post, me ajudou muito aqui no Instituto.Valeu.

  • Anonymous
    January 01, 2003
    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...

  • Anonymous
    January 01, 2003
    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.

  • Anonymous
    January 01, 2003
    This is totally cool, never knew it could be done.

  • Anonymous
    January 01, 2003
    Awesome, Gilson!!! Congrats!

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Thanks!

  • Anonymous
    January 01, 2003
    PRazAU, no way. You can install Hyper-V role, create VM, but cannot run it.

  • Anonymous
    January 01, 2003
    Great post!!

  • Anonymous
    June 26, 2013
    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

  • Anonymous
    June 26, 2013
    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.

  • Anonymous
    June 26, 2013
    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!

  • Anonymous
    June 26, 2013
    Olá Alexandro, realmente os comandos estavam invertidos, já corrigi. Obrigado pela observação.

  • Anonymous
    June 27, 2013
    That's what .. I filtered on all search engine.. Thanks a lot Sir.

  • Anonymous
    July 24, 2013
    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.

  • Anonymous
    August 07, 2013
    Que bom agora pode deixar de usar em meus labs vmware e utilizar o Hyper-V 3.0

  • Anonymous
    August 21, 2013
    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 ?

  • Anonymous
    August 23, 2013
    Very Nice! Working as expected (and hoped for) Thank you for your efforts and even more for the sharing.

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

  • Anonymous
    November 03, 2013
    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: www.trainsignal.com/.../run-hyper-v-vsphere-5-1

  • Anonymous
    November 05, 2013
    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?  

  • Anonymous
    November 18, 2013
    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?

  • Anonymous
    November 26, 2013
    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..

  • Anonymous
    November 29, 2013
    Perfect, I needed that for testing purposes only, Fair enough for me. Great workaround man and way to go. :D

  • Anonymous
    December 14, 2013
    Nice article, that's all I needed for my testing

  • Anonymous
    December 14, 2013
    Nice article, that's all I needed for my testing

  • Anonymous
    December 16, 2013
    The comment has been removed

  • Anonymous
    December 16, 2013
    The comment has been removed

  • Anonymous
    December 16, 2013
    Yes, We can run Microsoft Hyper-V on Hyper-visor (VMware Workstation). We can install Hyper-V, Create VM & able to power on VMsI found this below link on youtubehttp://www.youtube.com/watch?v=_cdV53j67EM

  • Anonymous
    January 05, 2014
    Pingback from IT / Help Desk crash course - ???????? 19

  • Anonymous
    January 16, 2014
    Many thanks, perfect.

  • Anonymous
    January 19, 2014
    Great great great...!!! Very nice for testing purposes... ;))))

  • Anonymous
    January 24, 2014
    Grande! Hermano... buen aporte... excelente para ambientes de pruebas....

  • Anonymous
    January 29, 2014
    Thanks

  • Anonymous
    February 02, 2014
    Thanks a lot !!

  • Anonymous
    February 04, 2014
    Thanks man....made my day :)

  • Anonymous
    February 12, 2014
    Thank you for the post, It helped me a lot!

  • Anonymous
    February 12, 2014
    Thanks you! Very useful the explanation!

  • Anonymous
    February 16, 2014
    Great post guys. It was very util here.

  • Anonymous
    March 05, 2014
    Thank you for this post!

  • Anonymous
    March 15, 2014
    The comment has been removed

  • Anonymous
    March 21, 2014
    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

  • Anonymous
    March 21, 2014
    The comment has been removed

  • Anonymous
    March 25, 2014
    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

  • Anonymous
    March 27, 2014
    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 ?

  • Anonymous
    April 03, 2014
    Thanks a ton! I was just wandering for days looking for this solution and it worked!

    Thanks!!!

  • Anonymous
    April 17, 2014
    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 ;)

  • Anonymous
    April 17, 2014
    Nice work, excellent paper. The info's are very helpfully.
    Thanks a lot dude

  • Anonymous
    May 20, 2014
    Grande post.....mas na hora de START da erro !!!!! Hyper-V components is not running....

  • Anonymous
    May 21, 2014
    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!!

  • Anonymous
    May 28, 2014
    Very Good
    Thank you a lot

  • Anonymous
    May 28, 2014
    Very Good
    Thank you a lot

  • Anonymous
    June 24, 2014
    Thank you for the help...its working

  • Anonymous
    August 11, 2014
    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.

  • Anonymous
    August 19, 2014
    Super!
    ThankZ

  • Anonymous
    August 25, 2014
    The comment has been removed

  • Anonymous
    August 27, 2014
    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.

  • Anonymous
    August 27, 2014
    :)

  • Anonymous
    October 20, 2014
    The comment has been removed

  • Anonymous
    November 02, 2014
    The comment has been removed

  • Anonymous
    November 04, 2014
    But...not able to create Virtual switch in

  • Anonymous
    November 13, 2014
    Good job :)

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

  • Anonymous
    December 02, 2014
    It does not work on Win2012r2, I will try on 2012.

  • Anonymous
    December 04, 2014
    I got it to work on my laptop using VMWARE Workstation 10 using this link..
    http://social.technet.microsoft.com/wiki/contents/articles/22283.how-to-install-hyper-v-on-vmware-workstation-10.aspx

  • Anonymous
    December 14, 2014
    thankss

  • Anonymous
    December 30, 2014
    thanks

  • Anonymous
    January 02, 2015
    hi,
    how to create cluster for this??

    regards,,

  • Anonymous
    January 02, 2015
    Great post...thanks very much !

  • Anonymous
    January 03, 2015
    Thanks for this, helped with making my 70-412 lab :-)

  • Anonymous
    February 05, 2015
    Muito obrigado funcionou.
    Thanks my friends you helped me. Congratulation

  • Anonymous
    March 05, 2015
    Thank You soo much. A great post. It helped me a lot. Great Work KEEP IT UP !!!!!!!!!!

  • Anonymous
    March 09, 2015
    Thanks a lot.

  • Anonymous
    March 14, 2015
    Excellent !!! it is very helpful!!

  • Anonymous
    March 20, 2015
    COOL !!!!
    Work fine !!!

  • Anonymous
    April 04, 2015
    Excellent

  • Anonymous
    April 16, 2015
    Brilliant step by step description Thanks very much :)

  • Anonymous
    April 16, 2015
    Brilliant step by step description Thanks very much :)

  • Anonymous
    April 27, 2015
    It works Thank you very much !!!!!!!!!!

  • Anonymous
    May 14, 2015
    excellent and thank a lot

  • Anonymous
    May 15, 2015
    Awesome post thank so much

  • Anonymous
    May 22, 2015
    The comment has been removed

  • Anonymous
    May 23, 2015
    Hello, your solution will be work on VMware witout SLAT?

  • Anonymous
    June 23, 2015
    I don't know how to Thank you I was looking for this solution for long time
    Merci

  • Anonymous
    June 23, 2015

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

  • Anonymous
    July 01, 2015
    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

  • Anonymous
    July 04, 2015
    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

  • Anonymous
    July 09, 2015
    Thank you very much!

  • Anonymous
    August 03, 2015
    Thanks Gilson for your great instruction!

  • Anonymous
    August 25, 2015
    You are my hero..Now I can finish my study

  • Anonymous
    August 31, 2015
    Try this: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2044876

  • Anonymous
    September 03, 2015
    Legend!!!!! Worked like a treat - good stuff

  • Anonymous
    October 07, 2015
    User profile disks allow users to save personal settings and files when they are signed in to a session

  • Anonymous
    November 06, 2015
    The comment has been removed

  • Anonymous
    November 27, 2015
    Thanks a lot buddy!! From Nayarit Mexico

  • Anonymous
    December 02, 2015
    it is able to run hyper-v 2008 R2 on hyper-v 2012 R2? Please kindly advise. Thanks

  • Anonymous
    January 06, 2016
    Thank you very much, it works perfectly

  • Anonymous
    April 11, 2016
    Change the OS type to 'hyper-v' or add this to your vmx file (in vmware):

    hypervisor.cpuid.v0 = "FALSE"