27. April 2021

Quick way to clear all Windows Defender exclusions

Windows Defender has support for a list of exclusions that won’t be considered for scanning. The UI for manipulating with exclusions is quite simple and does not allow operations on multiple exclusions at once. Fortunately, there are PowerShell commands which can help.

These commands are Add-MpPreference, Get-MpPreference, and Remove-MpPreference.

Following commands allows to quickly remove all exclusions of Path. The command must be started in Administrator’s shell:

foreach ($Path in $Paths) { Remove-MpPreference -ExclusionPath $Path }

A similar principle can be applied on the rest of the exclusions: ExclusionExtension, ExclusionIpAddress, ExclusionProcess

foreach ($Extension in $Extensions) { Remove-MpPreference -ExclusionExtension $Extension }

foreach ($Process in $Processes) { Remove-MpPreference -ExclusionProcess $Process }