91

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).

2
  • The method your using is the best and only supported method.
    – Ramhound
    Jan 22, 2013 at 17:29
  • 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
    Jan 22, 2013 at 20:05

8 Answers 8

75

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.

5
  • 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. Jan 24, 2013 at 0:57
  • 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
    Jan 24, 2013 at 4:21
  • 1
    You might want to use /NoRestart in a non-interactive setting (when calling from a script).
    – krlmlr
    Jul 7, 2015 at 8:44
  • 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
    Oct 13, 2017 at 23:41
  • @user276648 That's assuming Hyper-V is installed, after which sure, maybe. I only posted the answer I knew.
    – Mark Allen
    Oct 18, 2017 at 20:51
106

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

You should run both commands from an elevated command prompt.

To disable hypervisor:

bcdedit /set hypervisorlaunchtype off

To reenable hypervisor (changing it to default value):

bcdedit /set hypervisorlaunchtype auto

Of course it still requires restart.

3
  • 1
    This 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). Nov 17, 2014 at 20:25
  • 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
    Mar 27, 2015 at 1:53
  • 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. Oct 2, 2017 at 15:12
17

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
5
  • I've seen this now and it seems good! But havent had the time to try it myself yet. Sep 17, 2015 at 16:39
  • 3
    Just 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
    Sep 28, 2015 at 12:46
  • 2
    In PowerShell you need to use quotes for the ID. For example: bcdedit /set "{current}" hypervisorlaunchtype off
    – kishkin
    Apr 4, 2018 at 9:57
  • 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. Nov 30, 2018 at 3:18
  • 1
    best answer so far
    – Tien Dinh
    Aug 19, 2019 at 11:54
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
1
  • I installed vs2013 in w8.1 and apparently it installed hyper v making my vbox not work. Thanks for a good permanent answer.
    – MvcCmsJon
    Dec 14, 2013 at 3:24
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.

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
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`
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 ...)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .