Windows Defender에 Regkey 예외를 추가하는 스크립트

Windows Defender에 Regkey 예외를 추가하는 스크립트

Windows 파일 방어자에 제외를 추가하는 스크립트를 원하는 경우 다음 텍스트를 .bat 파일로 저장하고 실행하여 다음과 같은 작업을 수행할 수 있습니다.

powershell -inputformat none -outputformat none -NonInteractive -Command Add-MpPreference -ExclusionPath "mypath"

하지만 비슷한 방식으로 Windows Defender에 레지스트리 항목 예외를 추가하고 싶다면 어떻게 해야 합니까? Windows Defender에 예외로 레지스트리 항목을 추가하는 것이 가능합니까?

답변1

실제로 대답은 아니지만 레지스트리를 통해 수행합니다. 여기에 정보가 있습니다.

파일 및 폴더 제외는 아래 레지스트리 키에 저장됩니다.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths

파일 형식 제외는 아래 레지스트리 키에 저장됩니다.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Extensions

프로세스 제외는 아래 레지스트리 키에 저장됩니다.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Processes

감사합니다,

알바로 라마드리드

답변2

보시다시피 해당 코드를 사용하여 Powershell에서 예외를 생성할 수 있습니다.

Add-MpPreference -ExclusionPath %NameOfThePathOrFile% -Force

-Force 명령은 우회 사용자 확인을 위한 명령입니다.

작업에 필요한 다른 기능은 최소한 관리자 권한으로 PowerShell을 실행하는 것이므로 다음을 사용하여 수행할 수 있습니다.

reg query "HKU\S-1-5-19\Environment" >nul 2>&1
if not %errorlevel% EQU 0 (
    cls
    powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
    exit
)

먼저 다음과 같이 goto를 만들 수 있습니다.

goto Admin
START Powershell -nologo -noninteractive -windowStyle hidden -noprofile -command ^
Add-MpPreference -ExclusionPath %NameOfThePath% -Force;
:Admin
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
if not %errorlevel% EQU 0 (
    cls
    powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
    exit
)

도움이 되길 바랍니다.

관련 정보