Convenient way to enable/disable Hyper-V in Windows 8

81

74

I really like the Hyper-V support in Windows 8, however, there are some situations in which I need to disable Hyper-V in order to run some apps which don't like to be executed even in the root partition of the virtualized environment.
What I've been currently doing is disabling the feature completely from the "Add or remove windows features" dialog and restarting, enabling it again when needed.
I would like to know if there's any better way to do this that comes to mind, it could even be a shortcut that i could double-click and will actually add or remove the feature for me and restart (I guess this may be possible with a PowerShell script).

Fredy Treboux

Posted 2013-01-22T17:18:01.540

Reputation: 921

The method your using is the best and only supported method. – Ramhound – 2013-01-22T17:29:02.590

1@Ramhound You can use dism.exe to enable features from the command line. That's how we automate installing .NET 3.5 on Windows 8, for example. In theory you can disable features that way too, but I haven't tried it. – Mark Allen – 2013-01-22T20:05:46.640

Answers

69

Disclaimer: I haven't done this for removing a feature, AND as a final caveat there's probably going to be a slew of Windows Update updates to install every time you enable it again.

Having said that, from an elevated command prompt:

dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

and

dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

Here's what running the enable command looks like on my PC, which already has Hyper-V enabled and running:

>dism /Online /enable-feature:Microsoft-Hyper-V /All

Deployment Image Servicing and Management tool Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Enabling feature(s) [==========================100.0%==========================] The operation completed successfully.

When enabling the feature since it's Hyper-V it might ask you to reboot and run the command again. That seems vaguely familiar. You could wind up having to reboot twice, in other words. But maybe it won't do it to you since that machine already had Hyper-V enabled before.

Mark Allen

Posted 2013-01-22T17:18:01.540

Reputation: 2 801

1You might want to use /NoRestart in a non-interactive setting (when calling from a script). – krlmlr – 2015-07-07T08:44:53.820

The answer below with bcdedit is way faster and is the only thing necessary (you still have to restart no matter what). That's what I do whenever I need to switch to VMWare. – user276648 – 2017-10-13T23:41:46.533

@user276648 That's assuming Hyper-V is installed, after which sure, maybe. I only posted the answer I knew. – Mark Allen – 2017-10-18T20:51:04.913

Thanks!, it worked like a charm. It did restart twice but I don't think there's a way past that. Also, it could be argued that its not that much of an improvement over going to the windows features screen but once left in the desktop or pinned to the start screen it surely is for lazy people like myself. – Fredy Treboux – 2013-01-24T00:57:52.850

Sure! I'm glad it worked. Yeah normally the command line stuff is used to set up machines initially, so that way if you need to install .NET 3.5, AND Hyper-V, AND a bunch of other stuff, you can do it completely automatically. – Mark Allen – 2013-01-24T04:21:00.320

89

This is an old answer but for the sake of completeness and because I knew there was a better way than the top result.

From an elevated command prompt:

bcdedit /set hypervisorlaunchtype off

to disable hypervisor, and:

bcdedit /set hypervisorlaunchtype auto

to reenable it (default value).

Of course it still requires restart.

Dim

Posted 2013-01-22T17:18:01.540

Reputation: 4 322

1This is the way to go if you develop windows phone apps on a microsoft surface pro 3 (so you need hyper-v), but you want connected standby to work whenever you're not actively developing (as of late 2014, connected standby is not supported when the hypervisor is running). – Chris – 2014-11-17T20:25:32.877

Just to post an update as I came here looking for the above commands again (To run VM Ware Player temporarily) - Windows 10 supports Hyper-V and Connected Standby at the same time in the Tech Preview and I can only assume will keep the feature through to RTM. Seems to work well in the preview on my Surface Pro 3 so far. – Dan Harris – 2015-03-27T01:53:17.097

This saved me from so much frustration. Hyper-V doesn't like my video driver and dell has updates to the driver blocked so I can't use Intel's updated drivers. I have to disable Hyper-V if I wan't to run multiple monitors. – Ed Charbeneau – 2017-10-02T15:12:26.873

13

You could create two boot entries so you could choose to decide to boot OS system with or without Hyper-V.

  1. Type the following in the command prompt:
bcdedit /copy {default} /d "No Hypervisor"
  1. It says:
"The entry was successfully copied to {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}."
  1. Then type the following command:
bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} hypervisorlaunchtype off

Maks

Posted 2013-01-22T17:18:01.540

Reputation: 239

I've seen this now and it seems good! But havent had the time to try it myself yet. – Fredy Treboux – 2015-09-17T16:39:53.863

3Just a note: if on Windows 10, you have have to use {current}. Just run bcdedit to check. Also, it doesn't want to work in PowerShell, for anyone who tried it. – dotbat – 2015-09-28T12:46:39.353

1In PowerShell you need to use quotes for the ID. For example: bcdedit /set "{current}" hypervisorlaunchtype off – kishkin – 2018-04-04T09:57:00.907

This is the most elegant Answer thus far, in my opinion. Another tip is that you can hold the Shift key when you click Start -> Power button -> Restart, which will enable you to choose whether to boot with/without Hyper-V enabled before the computer restarts. This is especially useful when some form of "fastboot" is enabled in the BIOS, and it's nearly impossible to hit the "enter BIOS" key before the Windows bootloader assumes control. – Ben Johnson – 2018-11-30T03:18:35.267

1best answer so far – Tien Dinh – 2019-08-19T11:54:00.873

8

  • Hit the Windows Key and type “windows features”
  • Hit the Windows Key + W combo to bring up the Windows Settings panel of the Start Screen.
  • Click on Turn Windows features on or off
  • When the Turn Windows features on or off dialog appears, look for Hyper-V and deselect it
  • Click OK
  • Restart your computer when prompted
  • Install VMware Workstation
  • Enable Hyper-V again through the Turn Windows features on or off dialog
  • Restart your computer

For Windows 10:

  • Press Windows key
  • Type "Turn Windows features on or off"
  • Deselect checkbox next to Hyper-V
  • Select OK
  • Select Restart now

alex

Posted 2013-01-22T17:18:01.540

Reputation: 89

I installed vs2013 in w8.1 and apparently it installed hyper v making my vbox not work. Thanks for a good permanent answer. – MvcCmsJon – 2013-12-14T03:24:03.747

4

You can use Hyper-V Switch that basically employs the bcdedit method already described here but puts a simple one-click GUI over it. It shows you the current configuration state and lets you enable or disable Hyper-V and reboots the computer, too. I’ve made this little tool and it works on my Windows 10 computer.

ygoe

Posted 2013-01-22T17:18:01.540

Reputation: 1 597

4

Powershell is also possible, using DISM wrapped as PS cmdlets, and one can read the settings first before doing the change.

//Test
PS> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

//Turn off
PS> Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

//Turn on
PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All

Refs

  1. Powershell saw in this 2014-03 post which summarizes all options, http://www.eightforums.com/tutorials/42041-hyper-v-enable-disable-windows-8-a.html; MS Doc tell about the Get-WindowsOptionalFeature option, http://technet.microsoft.com/en-us/library/hh852173.aspx
  2. The Boot Entry Config Data edit (BECD) can also Read (/export) settings, per http://technet.microsoft.com/en-us/library/cc709667%28v=ws.10%29.aspx and other Doc http://msdn.microsoft.com/en-us/library/windows/hardware/ff542202%28v=vs.85%29.aspx

AnneTheAgile

Posted 2013-01-22T17:18:01.540

Reputation: 345

1

I made a PowerShell script to help enable/disable Hyper-V. This checks the state so you don't reboot if you are already in the desired state:

param([string]$state='Off')
'Set Hyper-V ' + $state
$lines = bcdedit
ForEach($line in $lines) {
    $pos = $line.IndexOf(' ')
    If($pos -gt 0) {
        $prompt = $line.Substring(0, $pos)
        $curstate = $line.Substring($pos).Trim()
        If($prompt -eq 'hypervisorlaunchtype') {
            '[' + $prompt + '] = [' + $curstate + ']'
            If($curstate -ne $state) {
                'Setting hypervisorlauchtype to ' + $state
                $result = bcdedit /set hypervisorlaunchtype $state
                'Result = [' + $result + ']'
                If($result -eq 'The operation completed successfully.') {
                    'Restarting in two seconds'
                    Start-Sleep -s 2
                    Restart-Computer
                } Else {
                    'Error setting state'
                    Start-Sleep -s 5
                }
            } Else {
                'Hypervisor launch type is already ' + $state
                Start-Sleep -s 5
            }
        }
    } 
}

Then create two shortcuts on your desktop "Hyper-V Off" Target:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Scripts\SetHyper-V.ps1 -state Off

and "Hyper-V On" Target:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Scripts\SetHyper-V.ps1 -state Auto`

Don Wilson

Posted 2013-01-22T17:18:01.540

Reputation: 11

0

  1. From windows console (cmd) with Admin rights:

Cleanup & house-keeping the Windows Component Store (WinSxS)

Dism /Online /Cleanup-Image /RestoreHealth
Dism.exe /online /Cleanup-Image /StartComponentCleanup

Analyzes system files and restores if necessary

sfc /scannow

(According to https://ugetfix.com/ask/how-to-disable-hyper-v-in-windows-10/ )

  1. Turn off hypervisor auto-start at boot configuration
bcdedit /set {current} hypervisorlaunchtype off

(Source: https://blogs.technet.microsoft.com/gmarchetti/2008/12/07/turning-hyper-v-on-and-off/)

  1. Windows PowerShell (with administrative privileges):
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

(Sources: https://ugetfix.com/ask/how-to-disable-hyper-v-in-windows-10/ and https://support.microsoft.com/en-us/help/3204980/virtualization-applications-do-not-work-together-with-hyper-v-device-g)

  1. Turn Windows Features On or off -> Hyper-V all unticked

(https://support.microsoft.com/en-us/help/3204980/virtualization-applications-do-not-work-together-with-hyper-v-device-g)

  1. This PC, Properties, Device Manager, System Devices and remove Hyper-V there as well.

For completeness, certain Virtualization issues are related to the Device Guard and Credential Guard security features:

  1. mmc.exe, add snap-in Local Computer Policy Under Computer Configuration / Administrative Templates / System / Device Guard / Turn On Virtualization Based Security

  2. Core isolation in Settings / Update & Security / Windows Security / Device Security / Core isolation

(Ref: https://support.microsoft.com/en-us/help/3204980/virtualization-applications-do-not-work-together-with-hyper-v-device-g

https://www.tenforums.com/tutorials/68913-enable-disable-device-guard-windows-10-a.html ; https://blogs.technet.microsoft.com/ash/2016/03/02/windows-10-device-guard-and-credential-guard-demystified/

https://weblogs.asp.net/dixin/run-hyper-v-and-vmware-virtual-machines-on-windows-10

https://www.dell.com/support/article/lu/fr/lubsd1/sln304974/windows-10-enterprise-security-credential-guard-and-device-guard?lang=en ...)

Jose Manuel Gomez Alvarez

Posted 2013-01-22T17:18:01.540

Reputation: 126