Windows PowerShell:- Adding windows defender exclusions
If you are running Exchange, you are aware that you need to exclude certain folders, processes etc. from scanning for Exchange to run optimally.
Now if you have System Center Configuration Manager (SCCM) in your environment, adding exclusions is easy and you can paste many lines in to the list.
However with no SCCM and just a + button you can only add 1 item at a time. With so many exclusions for Exchange, this can be rather tedious.
Here is a sample of adding an exclusion with Powershell:
- Add-MpPreference -ExclusionPath “%ExchangeInstallPath%ClientAccess\OAB”
You can refresh Windows Defender in Settings and you will now see the above path excluded.
If you wanted to exclude an extension then you can run this command:
- Add-MpPreference -ExclusionExtension “.chk”
Hope it helps.