-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toggle-Hyper-V.bat
47 lines (39 loc) · 1.07 KB
/
Toggle-Hyper-V.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
TITLE Toggle Hyper-V
cls
echo(
echo(
echo(
echo Select Option
echo =======================================
echo(
echo 1) "Enable Hyper-V"
echo 2) "Disable Hyper-V"
echo(
CHOICE /M Select /C 12
If Errorlevel 2 Goto 2
If Errorlevel 1 Goto 1
:1
echo "Enabling Hyper-V..."
pause
echo "Setting hypervisorlaunchtype auto"
bcdedit /set hypervisorlaunchtype auto
echo "Enabling Hyper-V"
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Goto end
:2
echo "Disabling Hyper-V..."
pause
echo "Setting hypervisorlaunchtype off"
bcdedit /set hypervisorlaunchtype off
echo "Setting Registry keys"
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d 0 /f
echo "Disabling Hyper-V"
DISM /Online /Disable-Feature /All /FeatureName:Microsoft-Hyper-V
Goto end
:end
echo "*** A Restart is needed... Please save your work before continuing... ***"
echo "(Press 'Ctrl' + 'C' or close the script if you wish to restart later)"
pause
shutdown /r
exit