What is Hyper-V and what is it for
Hyper-V is the Microsoft hypervisor which is included in the Pro, Enterprise and Education editions of Windows 10. This is in charge of virtualizing hardware, using functions of the system’s own CPU, so that we can create our virtual machines on which to install other operating systems. This hypervisor works at the same level as others, such as VirtualBox or VMware, but has greater integration with the operating system. For this reason, for a long time they have been incompatible with each other, although today it is possible to use these programs even with Hyper-V activated (they use Microsoft’s hypervisor instead of their own). With this hypervisor it is possible to install any edition of Windows, as well as other systems such as Linux. However, if we try to virtualize macOS we will be too limited.
This hypervisor not only allows us to install other operating systems on top of Windows 10 (a task that, on the other hand, is complicated and not very intuitive, which makes it not worth it), but it is also necessary to be able to use the Windows Subsystem for Linux, WSL, or the Windows Sandbox. There are even apps, like Docker, which require this feature to be enabled in Windows.
How to activate Hyper-V
By default, this feature is disabled, since the number of users who really need it is very small. Therefore, if we want to use it we will have to activate it manually. Of course, first of all, we must take into account that we need have a Windows 10 Pro installed on the computer (this feature is not available in the Home edition) and, in addition, we must have enabled the virtualization functions of the CPU in the BIOS / UEFI of our computer. These are VT-x and VT-d in the case of Intel, and AMD-V and AMD-Vi in the case of AMD.
From Windows features
The hypervisor is included within the optional features of the operating system. Therefore, one of the easiest ways to activate it is from this section. To do this, we write in the Windows 10 search engine «Windows features»And we open
A new window will appear from which we will be able to select the characteristics of the operating system to install or uninstall them. We look for the section that says «Hyper-V«, And we mark it. Within this section you will find the hypervisor as such and its own virtual machine administration tool.
A window will appear from which the necessary components will be downloaded and copied to the system. Of course, to complete the installation and for this function to be enabled, it will be necessary to restart the computer. When it starts up again, we can start enjoying this feature.
From PowerShell
If we do not want to carry out the previous steps, it is also possible to do the same with a simple PowerShell command. To do this, what we must do is open the Microsoft console, with Administrator permissions, and execute the following command in it:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
The system will be in charge of searching and downloading all the libraries and dependencies necessary to enable this function, and it will activate it on our computer. When we restart we will be able to see how the necessary changes are applied (therefore, it may take a little longer than normal in the restart) and, when we return to the desktop, we will have this function already available to use it.
If we already have Hyper-V installed on the computer, but we have disabled it manually (or another program has done it), it is not necessary to reinstall the feature, since it is already present on the PC. What we can do is use bcedit to enable it. To do this, we open a PowerShell window again, with Administrator permissions, and we will execute the following command:
bcdedit /set hypervisorlaunchtype auto
This command configures the hypervisor launcher to start automatically at system startup. Therefore, after restarting, Hyper-V will be activated again without problems.
Disable Windows virtualization
If we no longer need to use the virtualization functions of Windows we can uninstall Hyper-V, or deactivate the service. In this way we will avoid having the service running on our PC and, if we use other virtualization programs (such as VMware or VirtualBox) we will force them to use their own hypervisors instead of Microsoft’s.
From Windows features
In the same way that we have enabled Hyper-V from the additional features, if we already have it installed we can uninstall it from there. To do this, we reopen the «Windows Features» panel from the search engine, and in the window that will appear we will locate the Hyper-V entry.
We make sure that the “Hyper-V” entry is unchecked (as well as its subentries, which will be automatically disabled) and accept the changes. Again, after restarting Windows, this feature will be disabled.
From PowerShell
If we want to completely disable and uninstall this Windows feature, we can easily do it with a simple PowerShell command. To do this, we will simply open a Windows advanced console window, with administrator permissions, and execute the following command in it:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
After disabling the Windows hypervisor using this command, the only thing left to do is reboot the system and that’s it. When restarting, we will see a message that will tell us that changes are being made. When Windows restarts Hyper-V it will be disabled and completely uninstalled.
If we don’t want to uninstall it completely, and just want to disable it temporarily, we can use bcedit to disable it. This will leave the files on the PC, but the hypervisor will not work, so it will not cause problems with other programs such as VMware or VirtualBox. To do this, we can open a PowerShell window, also with Administrator permissions, and we will execute:
bcdedit /set hypervisorlaunchtype off
When restarting the PC, the hypervisor will be disabled. And we can activate it again, if needed, without having to download and install the optional feature.
Hyper-V Switch: turn the hypervisor on and off quickly
If we do not want to activate and deactivate this feature by executing the commands over and over again, there is a simple tool that will allow us to do it with a single click: Hyper-V Switch. This simple program is in charge of analyzing the current state of Windows virtualization and, if it is activated, it allows us to deactivate it, while if it is deactivated it allows us to activate it. Simple as that.
The program will let us know if the service is active, if it is active but not running (for example, in the absence of a restart), if it is disabled and if it is disabled but still running (in the absence of a restart). It will even tell us if Hyper-V is not installed on the system, but if so, it will not allow us to install it.
This program is completely free and open source, and we can download it from the following link.
How to tell if Hyper-V is on or off
If we do not know if Hyper-V is activated or deactivated in our system, we can check it in several ways. The fastest and easiest is by using a simple command PowerShell. This command will look for the Windows hypervisor feature and will tell us if it is enabled or disabled. To do this, we will open a PowerShell window with Administrator permissions again and execute this command:
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
If the “State” section indicates “Enabled”, we have it enabled. On the contrary, if it indicates “Disabled”, it is disabled.
Another way to check if this feature is working or not is with this other command, which is in charge of checking the status of the service to see if it is working or not. This must be run in a PowerShell window with Administrator permissions, because otherwise it will not work.
get-service | findstr vmcompute