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:

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

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

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

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