Windows Defender Exclusion Bulk Cleanup Guide

When the Windows Defender exclusion list accumulates a large number of useless entries, you can clean them all at once with a PowerShell one-liner. This article details the entire process, including backup, cleanup, and verification.

Prerequisites

Modifying Defender configuration requires administrator privileges. Open a terminal with sufficient permissions as follows:

  1. Click the Windows Start menu and search for PowerShell
  2. Right-click Windows PowerShell in the search results, then select Run as administrator
  3. Click Yes in the User Account Control (UAC) window to confirm authorization

Before cleaning, it is recommended to back up the current exclusion list to prevent accidentally deleting entries you want to keep. If needed later, you can restore from the backup file.

In the opened administrator PowerShell window, copy and paste the following command and press Enter:

powershell
1
2
3
# Backup all exclusions to a file on the C drive root
Get-MpPreference | Select-Object ExclusionPath, ExclusionExtension, ExclusionProcess | 
    Export-Csv -Path "C:\Defender_Exclusions_Backup.csv" -NoTypeInformation

After execution, you will find a backup file named Defender_Exclusions_Backup.csv in the C:\ root directory, which contains all current exclusion configurations.

Step 2: Execute Bulk Cleanup

Once the backup is complete, run the following command to clean all types of exclusions (including path exclusions, file extension exclusions, and process exclusions) with one command:

powershell
1
2
3
4
5
6
7
# Bulk clean all Defender exclusions
Get-MpPreference | Select-Object -Property ExclusionExtension | 
    ForEach-Object { if ($_.ExclusionExtension -ne $null) { Remove-MpPreference -ExclusionExtension $_.ExclusionExtension } }
Get-MpPreference | Select-Object -Property ExclusionPath | 
    ForEach-Object { if ($_.ExclusionPath -ne $null) { Remove-MpPreference -ExclusionPath $_.ExclusionPath } }
Get-MpPreference | Select-Object -Property ExclusionProcess | 
    ForEach-Object { if ($_.ExclusionProcess -ne $null) { Remove-MpPreference -ExclusionProcess $_.ExclusionProcess } }

Note: The command automatically checks whether each type of exclusion exists. Even if a certain category is empty, it will not produce an error and will skip it automatically.

Step 3: Verify Cleanup Results

After executing the cleanup command, use the following command to check the current exclusion list and confirm that everything has been cleared:

powershell
1
2
# View remaining exclusions
Get-MpPreference | Select-Object ExclusionPath, ExclusionExtension, ExclusionProcess

If all three properties show as empty in the output, the cleanup is complete.

Important Notes

Irreversible Operation

Once the cleanup is complete, all previously added exclusions will be removed. Windows Defender will resume scanning all files and processes. If you need to keep certain exclusions, you must re-add them after cleaning.

Permissions

If you see a “Permission denied” error when running the command, make sure you are running PowerShell as an administrator. Standard user permissions cannot modify Defender’s system configuration.

System Compatibility

This method applies to the following Windows versions:

  • Windows 10
  • Windows 11
  • Windows Server 2016 and later