Created
July 21, 2022 13:24
-
-
Save SakiiR/7c9a9420adf71e807ef4cfb9d4296da3 to your computer and use it in GitHub Desktop.
HyperV toggle - Faceit =)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo Virtualization must be disabled to use anti-cheat clients like FACEIT and ESEA | |
echo. | |
net session >nul 2>&1 | |
if %ERRORLEVEL% EQU 0 goto :chchchchoices | |
echo This script requires elevated privileges. Re-run as Administrator to continue | |
goto :exit | |
:chchchchoices | |
echo. | |
echo Press 1 to ENABLE virtualization | |
echo Press 2 to DISABLE virtualization | |
echo Press 3 to ENABLE Windows Subsystem for Linux (WSL) | |
echo Press 4 to ENABLE WSL 2 | |
echo Press 9 to exit | |
choice /C 12349 | |
if %ERRORLEVEL% EQU 1 goto :enablevirt | |
if %ERRORLEVEL% EQU 2 goto :disablevirt | |
if %ERRORLEVEL% EQU 3 goto :enablewsl | |
if %ERRORLEVEL% EQU 4 goto :enablewsl2 | |
if %ERRORLEVEL% EQU 5 goto :exit | |
:enablevirt | |
bcdedit /set hypervisorlaunchtype auto | |
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d 1 /f | |
echo. | |
echo Virtualization has been enabled. Restart for changes to take effect. | |
goto :chchchchoices | |
:disablevirt | |
bcdedit /set hypervisorlaunchtype off | |
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d 0 /f | |
echo. | |
echo Virtualization has been disabled. Restart for changes to take effect. | |
goto :restart | |
:enablewsl | |
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
echo. | |
echo Windows Subsystem for Linux version 1 has been installed. To update to version 2, a restart is required. | |
goto :restart | |
:enablewsl2 | |
wsl --set-default-version 2 | |
echo. | |
if %ERRORLEVEL% EQU 0 (echo WSL2 is now the default version) else (echo "Something went wrong") | |
goto :chchchchoices | |
:restart | |
echo. | |
echo Restart now? | |
choice /C YN | |
if %ERRORLEVEL% EQU 1 goto :restartmeow | |
if %ERRORLEVEL% EQU 2 goto :exit | |
:restartmeow | |
shutdown /r /t 0 | |
:exit | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment