1+ @ echo off
2+
3+
4+ echo
5+
6+ title Defeat defender: originally by swagkarna, modified by Msprg
7+ :: BatchGotAdmin
8+ :: -----------------------------------------
9+ REM --> CheckING for permissions
10+ > nul 2 >& 1 " %SYSTEMROOT% \system32\cacls.exe" " %SYSTEMROOT% \system32\config\system"
11+
12+ REM --> If error flag set, we do not have admin.
13+ if '%errorlevel% ' NEQ '0' (
14+ echo Requesting administrative privileges...
15+ goto UACPrompt
16+ ) else ( goto gotAdmin )
17+
18+ :UACPrompt
19+ echo Set UAC = CreateObject^ (" Shell.Application" ^ ) > " %temp% \getadmin.vbs"
20+ set params = %* :" ="
21+ echo UAC.ShellExecute " cmd.exe" , " /c %~s0 %params% " , " " , " runas" , 1 >> " %temp% \getadmin.vbs"
22+
23+ " %temp% \getadmin.vbs"
24+ del " %temp% \getadmin.vbs"
25+ exit /B
26+
27+ :gotAdmin
28+ echo msgbox " Please Wait While we install necessary packages for You!.Window will be closed after Installation! !!" > %tmp% \tmp.vbs
29+ REM wscript %tmp%\tmp.vbs
30+ del %tmp% \tmp.vbs
31+
32+ echo Gathering dependencies...
33+
34+ color 0a
35+
36+ copy %~dp0 \NSudo.exe %temp% \NSudo.exe
37+
38+ cd %temp%
39+
40+ REM bitsadmin/transfer Explorers /download /priority FOREGROUND https://raw.githubusercontent.com/swagkarna/Bypass-Tamper-Protection/main/NSudo.exe %temp%\NSudo.exe
41+
42+ set pop = %systemroot%
43+
44+ echo This is last chance to abort before Diabling Windows Defender permanently! Close window or 2x control-c to abort.
45+ pause
46+ echo Permanently disabling Windows Defender NOW!
47+
48+ REM cripples SmartAssScreen
49+ NSudo -U:T -ShowWindowMode:Hide icacls " %pop% \System32\smartscreen.exe" /inheritance:r /remove *S-1-5-32-544 *S-1-5-11 *S-1-5-32-545 *S-1-5-18
50+
51+ REM NSudo -U:T -ShowWindowMode:Hide reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t REG_DWORD /d "0" /f
52+
53+ REM Disables annoying notifications about Defender being non-functional.
54+ NSudo -U:T -ShowWindowMode:Hide reg add " HKLM\Software\Policies\Microsoft\Windows Defender\UX Configuration" /v " Notification_Suppress" /t REG_DWORD /d " 1" /f
55+
56+
57+ REM NSudo -U:T -ShowWindowMode:Hide reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoRun" /t REG_DWORD /d "1" /f
58+
59+
60+
61+ REM Stop, disable, backup and REMOVE the 'windefend' service.
62+ NSudo -U:T -ShowWindowMode:Hide sc stop windefend
63+
64+ NSudo -U:T -ShowWindowMode:Hide sc config windefend start= disabled
65+
66+
67+ NSudo -U:T -ShowWindowMode:Hide reg copy " HKLM\SYSTEM\CurrentControlSet\Services\WinDefend" " HKLM\SYSTEM\CurrentControlSet\Services\DISABLEDWinDefend.BAK" /s /f
68+
69+
70+
71+ NSudo -U:T -ShowWindowMode:Hide sc delete windefend
72+
73+
74+
75+
76+
77+
78+ REM ignore bat files
79+ REM powershell.exe -command "Add-MpPreference -ExclusionExtension ".bat""
80+
81+ REM Disables 'Startup repair' - as it may reintroduce the defender back. My experience is, it's safe to turn it back on some time later.
82+ NSudo -U:T -ShowWindowMode:Hide bcdedit /set {default} recoveryenabled No
83+
84+ REM boot even trough non-fatal failures and security violations.
85+ REM NSudo -U:T -ShowWindowMode:Hide bcdedit /set {default} bootstatuspolicy ignoreallfailures
86+
87+ REM powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ExclusionPath '"%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'"
88+
89+ REM powershell.exe New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force
90+
91+ REM Disables/changes some other Windows Security/Defender related settings.
92+ powershell.exe -command " Set-MpPreference -EnableControlledFolderAccess Disabled"
93+
94+ powershell.exe -command " Set-MpPreference -PUAProtection disable"
95+
96+ powershell.exe -command " Set-MpPreference -HighThreatDefaultAction 6 -Force"
97+ powershell.exe -command " Set-MpPreference -ModerateThreatDefaultAction 6"
98+
99+ powershell.exe -command " Set-MpPreference -LowThreatDefaultAction 6"
100+
101+ powershell.exe -command " Set-MpPreference -SevereThreatDefaultAction 6"
102+
103+ powershell.exe -command " Set-MpPreference -ScanScheduleDay 8"
104+
105+ REM Disables firewall - DO NOT ENABLE YOU ALMOST NEVER WANT TO BE WITHOUT FIREWALL!
106+ REM powershell.exe -command "netsh advfirewall set allprofiles state off"
107+
108+ echo If all looks good, you can reboot now.
109+ pause > nul
0 commit comments