forked from ionuttbara/windows-defender-remover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScript_Run.bat
133 lines (122 loc) · 6.75 KB
/
Script_Run.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@echo off & pushd "%CD%" & CD /D "%~dp0"
:--------------------------------------
:: Arguments Section
IF "%1"== NUL GOTO :menu
IF "%1"== "/y" GOTO :removedef
IF "%1"== "/Y" GOTO :removedef
IF "%1"== "/N" GOTO :tweaksdef
IF "%1"== "/n" GOTO :tweaksdef
IF "%1"== "/e" GOTO :enabledefanti
IF "%1"== "/E" GOTO :enabledefanti
IF "%1"== "/M" GOTO :tweaksdefanti
IF "%1"== "/m" GOTO :tweaksdefanti
IF "%1"== "/R" GOTO :enabledef
IF "%1"== "/r" GOTO :enabledef
:--------------------------------------
:--------------------------------------
:menu
cls
echo ------Defender Remover Script , version 12.6------
echo Select an option:
echo.
echo Press (Y) for removing Defender and Security Components (old method, breaking Windows Updates/UWP in some version of Windows, removes files and unregisters classes)
echo Press (N) for disabling Defender and Security Components (safe)
echo Press (M) for disabling Defender Antivirus only (safe)
echo Press (E) for enabling Defender (restore actions where M is pressed)
echo Press (R) for enabling Defender and Security Components (restore actions where N is pressed)
echo.
set /P c=Select one of the options to continue:
:: Check if the input is one of the valid keys
if /I "%c%" EQU "Y" goto :removedef
if /I "%c%" EQU "N" goto :tweaksdef
if /I "%c%" EQU "E" goto :enabledefanti
if /I "%c%" EQU "M" goto :tweaksdefanti
if /I "%c%" EQU "R" goto :enabledef
:: If none of the valid keys are pressed, do nothing
goto :eof
:--------------------------------------
:--------------------------------------
:removedef
cls
echo Killing Tasks...
for /f "delims=" %%i in (Remover\TKL.txt) do (GetTrustedInstaller.exe "C:\Windows\System32\taskkill.exe /f /im "%%i"") >nul
cls
echo Removing Windows Security UWP...
for /d %%f in ("C:\Program Files\WindowsApps\Microsoft.SecHealthUI*") do (GetTrustedInstaller.exe "C:\Windows\System32\cmd.exe /k rmdir /s /q "%%f"") >nul
cls
echo Applying Registry Files...
for /r %%k in (Remover\REGS\*.reg) do (GetTrustedInstaller.exe "C:\Windows\regedit.exe /s "%%k"") >nul
cls
echo Removing Windows Defender/Security Components Files...
for /f "delims=" %%i in (Remover\FDL.txt) do (GetTrustedInstaller.exe "C:\Windows\System32\cmd.exe /k del /f /q "%%i"") >nul
for /f "delims=" %%i in (Remover\DDL.txt) do (GetTrustedInstaller.exe "C:\Windows\System32\cmd.exe /k rmdir /s /q "%%i"") >nul
timeout /t 5 /nobreak
shutdown /r /f /t 0
goto :eof
:--------------------------------------
:--------------------------------------
:tweaksdef
if "%SAFEBOOT_OPTION%"=="" goto error
CLS & echo Disable Defender and Security Components...
:: Disable Defender's Scheduled Tasks
GetTrustedInstaller.exe cmd.exe /k "schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Disable"
GetTrustedInstaller.exe regedit.exe /s "DisablerS\Disable.reg" >nul
GetTrustedInstaller.exe cmd.exe /k move /y "C:\Windows\System32\smartscreen.exe" "C:\Windows\System32\smartscreen.plm"
cls & echo Antivirus and Security Components Disabled. A reboot is needed!
echo To exit from safe mode you must open an cmd and write this command and reboot.
echo bcdedit /deletevalue {default} safeboot
pause
goto :eof
:--------------------------------------
:--------------------------------------
:enabledef
if "%SAFEBOOT_OPTION%"=="" goto error
CLS & echo Enable Defender and Security Components...
:: Enable Defender's Scheduled Tasks
GetTrustedInstaller.exe cmd.exe /k "schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Enable"
GetTrustedInstaller.exe regedit.exe /s "DisablerS\Enable.reg"
GetTrustedInstaller.exe cmd.exe /k move /y "C:\Windows\System32\smartscreen.plm" "C:\Windows\System32\smartscreen.exe"
cls & echo Antivirus and Windows Security Components Enabled. A reboot is needed!
echo To exit from safe mode you must open an cmd and write this command and reboot.
echo bcdedit /deletevalue {default} safeboot
pause
goto :eof
:--------------------------------------
:--------------------------------------
:tweaksdefanti
if "%SAFEBOOT_OPTION%"=="" goto error
CLS & echo Disabling Defender...
:: Disable Defender's Scheduled Tasks
GetTrustedInstaller.exe cmd.exe /k "schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Disable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Disable"
GetTrustedInstaller.exe regedit.exe /s "Disabler\Disable.reg" >nul
GetTrustedInstaller.exe cmd.exe /k move /y "C:\Windows\System32\smartscreen.exe" "C:\Windows\System32\smartscreen.plm"
cls & echo Antivirus disabled. A reboot is needed!
echo To exit from safe mode you must open an cmd and write this command and reboot.
echo bcdedit /deletevalue {default} safeboot
pause
goto :eof
:--------------------------------------
:--------------------------------------
:enabledefanti
if "%SAFEBOOT_OPTION%"=="" goto error
CLS & echo Enable Defender...
:: Enable Defender's Scheduled Tasks
GetTrustedInstaller.exe cmd.exe /k "schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Enable & schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Enable"
GetTrustedInstaller.exe regedit.exe /s "Disabler\Enable.reg"
GetTrustedInstaller.exe cmd.exe /k move /y "C:\Windows\System32\smartscreen.plm" "C:\Windows\System32\smartscreen.exe"
echo To exit from safe mode you must open an cmd and write this command and reboot.
echo bcdedit /deletevalue {default} safeboot
shutdown /r /f /t 0
:--------------------------------------
:--------------------------------------
:error
echo To disable/enable Windows Defender you MUST to be in Safe Mode. Go to CMD and run this command and reboot.
echo bcdedit /set {current} safeboot minimal
pause
exit
:--------------------------------------
:--------------------------------------
:eof
:: End of script, do nothing
exit
:--------------------------------------