How to disable Hyper-V in Windows?

Why disable Hyper-V when using Genymotion Desktop?

Genymotion Desktop does not work well alongside Hyper-V at this time.

Hyper-V makes VirtualBox fall back to software virtualization.

VirtualBox start up errors can occur because of this fallback.

Booting time can become extremely long.

Major slowdown or stability issues can occur.

Therefore, we highly recommend disabling Hyper-V when using Genymotion Desktop.

Method 1: Using our "home-made" batch script

We have coded a batch file to allow to easily disable Hyper-V and all Windows features related to it.

> Warning: This batch script has been created with AI assistance and used internally at Genymotion. Make sure to review before use. You are solely responsible for its execution in your environment. REQUIRES ADMINISTRATOR PRIVILEGES.

To use it, copy the following code into the notepad (or any other text editor) and save it as "hyperv-tool.bat":

:: DISCLAIMER:
:: Created with AI assistance and used internally at Genymotion.
:: Shared for reference only. Review before use.
:: You are solely responsible for its execution in your environment.
:: REQUIRES ADMINISTRATOR PRIVILEGES.
:: ===============================================================

:: DESCRIPTION
:: Interactive tool to check and toggle Windows virtualization
:: features without having to navigate Windows Settings or run
:: manual PowerShell/DISM commands.

:: FEATURES MANAGED
:: [1] Hyper-V
:: [2] WSL2 - Windows Subsystem for Linux
:: [3] Windows Sandbox
:: [4] Virtual Machine Platform
:: [5] Windows Hypervisor Platform
:: [6] Memory Integrity (HVCI)
:: [7] Virtualization Based Security (VBS)

:: NOTES
:: Even when Hyper-V is disabled, features like Memory Integrity
:: (HVCI) and Virtualization Based Security (VBS) can silently
:: keep the Hyper-V hypervisor stack active, preventing third-party
:: hypervisors such as VirtualBox from accessing hardware
:: virtualization. Disabling those features fully releases hardware
:: virtualization to the guest hypervisor.

:: Features [1]-[5] are Windows Optional Features managed via DISM.
:: Features [6]-[7] are registry-based and take effect after reboot.

:: REQUIREMENTS
:: - Windows 10/11 Pro, Enterprise, or Education
:: - Must be run as Administrator
:: - Reboot required after any change

:: USAGE
:: Right-click > "Run as administrator"

@echo off
setlocal enabledelayedexpansion
if "%1"=="RELAUNCHED" goto:main
cmd /k "%~f0" RELAUNCHED
exit
:main
title Hyper-V ^& Virtualization Toggle

:: Check for Administrator privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
  echo [!] This script must be run as Administrator.
  echo Right-click the file and select "Run as administrator".
  exit /b 1
  goto:afterfunc
)

:: Helper: get Windows Optional Feature state
:GetFeatureState
set "TMPFILE=%TEMP%\feat_state.txt"
powershell -NoProfile -Command "(Get-WindowsOptionalFeature -Online -FeatureName '%~1').State" > "!TMPFILE!" 2>nul
set "%~2="
set /p %~2=<"!TMPFILE!"
del "!TMPFILE!" >nul 2>&1
for /f "tokens=* delims= " %%a in ("!%~2!") do set "%~2=%%a"

:: Helper: get registry-based feature state
:GetRegState
set "TMPFILE=%TEMP%\reg_state.txt"
reg query "%~1" /v "%~2" > "!TMPFILE!" 2>nul
set "_REGVAL="
for /f "tokens=3" %%a in ('type "!TMPFILE!" ^| findstr /i "%~2"') do set "_REGVAL=%%a"
del "!TMPFILE!" >nul 2>&1
if "!_REGVAL!"=="0x1" ( set "%~3=Enabled" ) else ( set "%~3=Disabled" )

:: Print a table row with fixed column widths
:PrintRow
:: %~1 = index, %~2 = label (max 38 chars), %~3 = state
set "_IDX=%~1"
set "_LBL=%~2 "
set "_LBL=!_LBL:~0,38!"
set "_ST=%~3"
if /i "!_ST!"=="Enabled" ( set "_ST=Enabled " )
if /i "!_ST!"=="Disabled" ( set "_ST=Disabled " )
if "!_ST!"=="" ( set "_ST=N/A " )
echo ^| [!_IDX!]!_LBL! ^|!_ST! ^\|

:afterfunc

:: Define all features
set "F1_LABEL=Hyper-V"
set "F1_TYPE=opt"
set "F1_NAME=Microsoft-Hyper-V-All"
set "F2_LABEL=WSL2 (Subsystem for Linux)"
set "F2_TYPE=opt"
set "F2_NAME=Microsoft-Windows-Subsystem-Linux"
set "F3_LABEL=Windows Sandbox"
set "F3_TYPE=opt"
set "F3_NAME=Containers-DisposableClientVM"
set "F4_LABEL=Virtual Machine Platform"
set "F4_TYPE=opt"
set "F4_NAME=VirtualMachinePlatform"
set "F5_LABEL=Windows Hypervisor Platform"
set "F5_TYPE=opt"
set "F5_NAME=HypervisorPlatform"
set "F6_LABEL=Memory Integrity (HVCI)"
set "F6_TYPE=reg"
set "F6_NAME=HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity"
set "F6_REGVAL=Enabled"
set "F7_LABEL=Virt. Based Security (VBS)"
set "F7_TYPE=reg"
set "F7_NAME=HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard"
set "F7_REGVAL=EnableVirtualizationBasedSecurity"

:: Check all feature states
echo Checking feature status, please wait...
for %%i in (1 2 3 4 5) do (
  call:GetFeatureState "!F%%i_NAME!" F%%i_STATE
  call:GetRegState "!F6_NAME!" "!F6_REGVAL!" F6_STATE
  call:GetRegState "!F7_NAME!" "!F7_REGVAL!" F7_STATE
)

:: Display status table
echo ^| Feature ^\| Status ^\|
for %%i in (1 2 3 4 5 6 7) do (
  call:PrintRow "%%i" "!F%%i_LABEL!" "!F%%i_STATE!"
)

:: Build enabled / disabled lists
set "ENABLED_LIST="
set "DISABLED_LIST="
for %%i in (1 2 3 4 5 6 7) do (
  if /i "!F%%i_STATE!"=="Enabled" set "ENABLED_LIST=!ENABLED_LIST! %%i"
  if /i "!F%%i_STATE!"=="Disabled" set "DISABLED_LIST=!DISABLED_LIST! %%i"

  :: Question 1: Which to ENABLE
  set "TO_ENABLE="
  if "!DISABLED_LIST!"=="" (
    echo [*] All features are currently enabled. Nothing to enable.
    echo Which features do you want to ENABLE?
    echo (Enter numbers separated by spaces, or press Enter to skip^)
    for %%i in (!DISABLED_LIST!) do (
      echo [%%i]!F%%i_LABEL!
      set /p "TO_ENABLE= Enable: "
    )
  )

  :: Question 2: Which to DISABLE
  set "TO_DISABLE="
  if "!ENABLED_LIST!"=="" (
    echo [*] All features are currently disabled. Nothing to disable.
    echo Which features do you want to DISABLE?
    echo (Enter numbers separated by spaces, or press Enter to skip^)
    for %%i in (!ENABLED_LIST!) do (
      echo [%%i]!F%%i_LABEL!
      set /p "TO_DISABLE= Disable: "
    )
  )

  :: Bail if nothing selected
  if "!TO_ENABLE!"=="" if "!TO_DISABLE!"=="" (
    echo [*] No changes selected. Goodbye.
    pause
    exit /b 0
  )

  :: Confirm summary
  echo Summary of changes:
  if not "!TO_ENABLE!"=="" (
    for %%i in (!TO_ENABLE!) do echo [+] ENABLE:!F%%i_LABEL!
  )
  if not "!TO_DISABLE!"=="" (
    for %%i in (!TO_DISABLE!) do echo [-] DISABLE:!F%%i_LABEL!
  )
  set /p "CONFIRM= Proceed? (Y/N): "
  if /i "!CONFIRM!" neq "Y" goto quit

  :: Apply ENABLE changes
  if not "!TO_ENABLE!"=="" (
    for %%i in (!TO_ENABLE!) do (
      echo Enabling!F%%i_LABEL!...
      if /i "!F%%i_TYPE!"=="opt" (
        powershell -NoProfile -Command "Enable-WindowsOptionalFeature -Online -FeatureName '!F%%i_NAME!' -NoRestart"
        reg add "!F%%i_NAME!" /v "!F%%i_REGVAL!" /t REG_DWORD /d 1 /f >nul
        echo [+]!F%%i_LABEL! ENABLED.
      )
    )
  )

  :: Apply DISABLE changes
  if not "!TO_DISABLE!"=="" (
    for %%i in (!TO_DISABLE!) do (
      echo Disabling!F%%i_LABEL!...
      if /i "!F%%i_TYPE!"=="opt" (
        powershell -NoProfile -Command "Disable-WindowsOptionalFeature -Online -FeatureName '!F%%i_NAME!' -NoRestart"
        reg add "!F%%i_NAME!" /v "!F%%i_REGVAL!" /t REG_DWORD /d 0 /f >nul
        echo [-]!F%%i_LABEL! DISABLED.
      )
    )
  )

  :: Reboot prompt
  echo A reboot is required for changes to take effect.
  echo [1] Reboot now
  echo [2] I will reboot later
  set /p "REBOOT= Enter your choice (1 or 2): "
  if "!REBOOT!"=="1" (
    echo Rebooting in 10 seconds... Close this window to cancel.
    timeout /t 10
    shutdown /r /t 0
    echo [*] Remember to reboot before the changes take effect.
    goto:quit
  )
  :quit
  echo [*] No changes made. Goodbye.
)

[view raw](https://gist.github.com/agavignet/e5a5f5a76d162c48f69e2910cf6fe073/raw/a182cf659a868b6c6625fc925c05f73a33abbe98/hyperv-tool.bat)
[hyperv-tool.bat](https://gist.github.com/agavignet/e5a5f5a76d162c48f69e2910cf6fe073#file-hyperv-tool-bat)

The script requires admin privileges: right-click on hyperv-tool.bat and select "run as administrator" to launch the script.

Then, follow the instructions to disable all features that uses Hyper-V. When done, reboot your PC.

You can also run this batch file to verify that Hyper-V is properly disabled.

Method 2: disable Hyper-V manually

If you do not wish to, or cannot, use a third party script, you can also disable Hyper-V manually.

Step 1: Disable Hyper-V features

1. Go to Control Panel Programs Turn Windows features on or off

2. Uncheck Hyper-V in Windows feature:

3. Click OK

4. Windows Feature will apply the changes and ask you to restart. Click Restart Now to reboot the PC and apply the changes.

Also, make sure that the following features are disabled:

Step 2: Disable Memory Integrity

Even though you have explicitly disabled Hyper-V, Windows 11 has several features that silently use the Hyper-V hypervisor in the background, which can prevent VirtualBox from accessing the hardware virtualization capabilities. One of those feature is the Memory Integrity security feature from the Core Isolation security measures.

To disable Memory Integrity: 1. Open Windows Security 2. Go to Device Security > Core isolation details 3. Turn Memory Integrity off 4. Reboot your PC when prompted

Step 3: Verify that Hyper-V is properly disabled

Open a PowerShell terminal and run the following command:

systeminfo | findstr -i "hyper-v requirements"

If Hyper-V is disabled, you should get the following output:

Hyper-V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes

Otherwise, Hyper-V is still enabled.

If you already followed instructions 1. and 2., and Hyper-V is still active, try following to completely disable Hyper-V manually.

> Warning: Windows 11 24H2 > There is a known bug with Windows 11 24H2 which makes it impossible to disable Hyper-V on some configurations. Make sure to use Windows 11 25H2 or higher, or upgrade Windows 11 24H2 to 25H2 if possible.