Skip to content

Commit 60a62b7

Browse files
committed
apply the DisableAntiSpyware policy before disabling defender services
1 parent 29595d1 commit 60a62b7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

additionals/DisableWD.bat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
@echo off
2+
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f
3+
"C:\Windows\System32\gpupdate.exe" /Target:Computer /Force
4+
25
set "controlset=HKLM\SYSTEM\ControlSet001"
36
set "services=%controlset%\Services"
4-
PowerShell -NonInteractive -NoLogo -NoProfile -C "Set-MpPreference -DisableRealtimeMonitoring 1" >NUL 2>nul
7+
::PowerShell -NonInteractive -NoLogo -NoProfile -C "Set-MpPreference -DisableRealtimeMonitoring 1" >NUL 2>nul
58
::Windows Defender
69
reg add "%services%\MsSecCore" /v "Start" /t REG_DWORD /d "4" /f >NUL 2>nul
710
reg add "%services%\MsSecFlt" /v "Start" /t REG_DWORD /d "4" /f >NUL 2>nul

additionals/EnableWD.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
@echo off
2+
3+
reg delete "HKLM\Software\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /f >NUL 2>nul
4+
"C:\Windows\System32\gpupdate.exe" /Target:Computer /Force
5+
26
set "services=HKLM\SYSTEM\ControlSet001\Services"
37
::Windows Defender
48
reg add "%services%\MsSecCore" /v "Start" /t REG_DWORD /d "0" /f >NUL 2>nul

0 commit comments

Comments
 (0)