Code
:: Enable or Disable Windows Defender Potentially Unwanted Applications (PUA) Protection in Windows 10
@Echo Off
Cls & Color 0E
call :IsAdmin
Cls & Mode CON LINES=11 COLS=95 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo Enable Windows Defender Potentially Unwanted Applications (PUA) Protection (Y/N)?
Echo.
Echo.
Echo.
Set /p input= RESPONSE:
If /i Not %input%==Y (Goto :_Ex) Else (Goto :_Start)
:_Ex
If /i Not %input%==N (Goto :EOF) Else (Goto :_RegRestore)
:_Start
Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "1" /f >Nul
Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "1" /f >Nul
Cls & Mode CON LINES=11 COLS=75 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo Enabling Potentially Unwanted Applications (PUA) Protection
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Goto Reboot
:_RegRestore
Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v "PUAProtection" /t REG_DWORD /d "0" /f >Nul
Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f >Nul
Cls & Mode CON LINES=11 COLS=75 & Color 0E & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo Disabling Potentially Unwanted Applications (PUA) Protection
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
:Reboot
CHOICE /C YN /M "Press Y to Reboot, N for exiting script."
If %errorlevel% == 1 ( Shutdown /r /t 0) Else (Exit)
:IsAdmin
Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
Cls & Echo You must have administrator rights to continue ...
Pause & Exit
)
Cls
goto:eof