Script to add Regkey Exception to Windows Defender

3

1

If I want some kind of script to add an exclusion to Windows file defender, I can do something along these lines by saving the following text as a .bat file and running it:

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

But what if I want to add, specifically, a registry entry exception to Windows defender in a similar manner, how would I acheive that? Is it even possible to add a registry entry as an exception to Windows defender?

ereHsaWyhsipS

Posted 2018-06-06T22:22:33.020

Reputation: 403

Answers

3

Not really an answer, but I do it through the registry here is the info:

File and folder exclusions are stored in the registry key below.

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

File type exclusions are stored in the registry key below.

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

Process exclusions are stored in the registry key below.

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

Sincerely,

Alvaro Lamadrid

Alvaro Lamadrid

Posted 2018-06-06T22:22:33.020

Reputation: 39

1

That's actually a better solution than the old method that I was using, but take a look here: https://i.imgur.com/tkxBCxv.png

Notice how one of the items is a "regkey" as opposed to a "file." How would I add that regkey as an exclusion using your method?

– ereHsaWyhsipS – 2018-06-07T00:54:01.427

Can you add registry exclusions? It looks like even throught the GUI you can only add File, File Type, Folder, or Process exceptions. – EBGreen – 2018-06-07T12:40:20.323

Here is Microsoft official documentation of the different ways IT Professionals have to manage exclusions in Windows Defender. https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-antivirus/configure-extension-file-exclusions-windows-defender-antivirus

– Alvaro Lamadrid – 2018-06-07T13:52:44.503

So it looks like no you cannot have registry exclusions. – EBGreen – 2018-06-07T14:21:58.043

1But how's the syntax of these registrys ? Let's say I need C:\wsl and C:\other this both forlders excluded, how would I change the value on the registry to achive this ? – aemonge – 2019-06-04T10:05:06.803