SaferComputing.com

Reference · Windows

Microsoft Defender exclusions and tamper protection: find, remove and lock down

Attackers add Microsoft Defender exclusions so their tools are not scanned. Check Get-MpComputerStatus and Get-MpPreference, remove exclusions with Remove-MpPreference, turn tamper protection on, then update with Update-MpSignature and run Start-MpWDOScan.

Published
Last checked
Applies to
Windows 10 and 11 with Microsoft Defender Antivirus; the offline scan does not run on ARM computers
Technical specification
Target artifactMicrosoft Defender Antivirus's exclusion lists, ExclusionPath, ExclusionProcess and ExclusionExtension in Get-MpPreference, and its protection state, AMRunningMode, RealTimeProtectionEnabled and IsTamperProtected in Get-MpComputerStatus.
Default behaviourMicrosoft says tamper protection is on by default and that exclusions are usually not needed. An administrator can still change Defender settings in Windows Security, and exclusions are tamper protected only on computers that Intune or Configuration Manager manages under Microsoft's conditions.
Safe stateAMRunningMode Normal, or the passive mode your security product expects; RealTimeProtectionEnabled and IsTamperProtected both True; no exclusion that you or your IT provider cannot explain.
Check on WindowsGet-MpComputerStatus | Select-Object AMRunningMode, RealTimeProtectionEnabled, IsTamperProtected
Check on WindowsGet-MpPreference | Select-Object ExclusionPath, ExclusionProcess, ExclusionExtension, in PowerShell as Administrator
Check in Windows SecurityVirus & threat protection, Manage settings, Exclusions, Add or remove exclusions
Fix on WindowsRemove-MpPreference -ExclusionPath 'PATH', and -ExclusionProcess or -ExclusionExtension for the other lists, in PowerShell as Administrator
Fix in Windows SecurityVirus & threat protection, Manage settings, Tamper Protection to On

Read the result

PropertyExpectedMeaning
AMRunningModeNormalDefender is the active antivirus. Microsoft's other values: passive mode, when another product is primary on a computer in Defender for Endpoint; SxS passive mode, alongside another product with limited periodic scanning; EDR block mode
RealTimeProtectionEnabledTrueReal-time protection is on
IsTamperProtectedTrueTamper protection is on

Each value in the three exclusion lists stops Defender from scanning something:

  • ExclusionPath: a file or a folder; a folder covers every file under it.
  • ExclusionProcess: files opened by that program. Microsoft notes this does not exclude the program itself; that takes a path exclusion.
  • ExclusionExtension: every file with that extension, such as dat.

Microsoft says you usually do not need any. On a home computer, an exclusion you did not add is a reason to read on.

List each exclusion on its own line, as Microsoft documents it
Windows PowerShell, as Administrator
$p = Get-MpPreference; 'ExclusionExtension','ExclusionPath','ExclusionProcess' | ForEach-Object { $t = $_; $p.$t | ForEach-Object {[pscustomobject]@{Type=$t; Value=$_}} } | Format-Table -AutoSize
Who can see the list

Microsoft's Defender configuration documentation says local users and administrators can see exclusions in Windows Security and PowerShell unless an organization sets HideExclusionsFromLocalUsers, or HideExclusionsFromLocalAdmins, which hides them from both; Windows 10 version 1809 and later, Pro, Enterprise and Education. Hidden exclusions still apply but do not show in Get-MpPreference or Registry Editor, so on a managed computer an empty list may be a hidden one.

Why attackers add exclusions

Unlike turning protection off, an exclusion leaves RealTimeProtectionEnabled at True while Defender skips the attacker's files. Microsoft has documented it:

  • 6 March 2025: in a malvertising campaign Microsoft detected in December 2024, which reached nearly one million devices, PowerShell called Add-MpPreference to add exclusion paths so the attacker's folders were not scanned.
  • 26 May 2026: in a cryptojacking campaign, utilities from lookalike download sites, surfaced in search results and AI chatbot answers, installed ScreenConnect for remote access, then registered path and process exclusions with Add-MpPreference, again on every cycle, so removed exclusions came back.
  • 1 September 2026: counterfeit installers added sweeping path exclusions through PowerShell, and an exclusion for the .dat extension, from a scheduled task running as SYSTEM.

Microsoft's October 2023 report on Octo Tempest advises looking for recent additions to security tools' exclusions. After a remote-access scam, assume the caller could do what you can: Microsoft notes that an administrator can still change Defender settings in Windows Security with tamper protection on.

Find when exclusions changed

Event 5007 records a configuration change with its old and new value; Microsoft says an unexpected one might be the result of malware. Event 5013 means tamper protection blocked a change, and 5001 that real-time protection was turned off.

Windows PowerShell, as Administrator
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-Windows Defender/Operational'; Id = 5007, 5013, 5001 } -MaxEvents 50 | Format-List TimeCreated, Id, Message

Compare the times with the day of the call. They also help find the remote-access tool or scheduled task that made the change.

Remove exclusions

  1. Remove what added them first, the remote-access tool, scheduled task or start-up entry, or it may add them back.
  2. Remove each value exactly as Get-MpPreference prints it; Remove-MpPreference reports an error for a value not in the list. In Windows Security, select it under Add or remove exclusions, then Remove.
Windows PowerShell, as Administrator
Remove-MpPreference -ExclusionPath 'C:\Users\Public\Example'
Remove-MpPreference -ExclusionProcess 'C:\Example\program.exe'
Remove-MpPreference -ExclusionExtension 'dat'
  1. Run the check again.
Remove every exclusion, on a home computer only

This clears all three lists. Not for a computer an IT provider manages: its software may need them.

Windows PowerShell, as Administrator
$p = Get-MpPreference
if ($p.ExclusionPath) { Remove-MpPreference -ExclusionPath $p.ExclusionPath }
if ($p.ExclusionProcess) { Remove-MpPreference -ExclusionProcess $p.ExclusionProcess }
if ($p.ExclusionExtension) { Remove-MpPreference -ExclusionExtension $p.ExclusionExtension }
Computers an organization manages

Exclusions can also come from Intune, Configuration Manager, Group Policy or the Microsoft Defender portal; change them there. With DisableLocalAdminMerge set to 1, settings an administrator adds on the computer are not merged with the organization's policy.

Tamper protection

With tamper protection on, Microsoft says real-time protection, behaviour monitoring, cloud protection and security intelligence updates stay on, and changes to Defender's settings through the registry are blocked. A change through a management tool, Group Policy included, may appear to succeed and still be blocked.

  • Turn it on: in Windows Security, Virus & threat protection, Manage settings under Virus & threat protection settings, set Tamper Protection to On. Microsoft says it is on by default, and shows a yellow warning under Virus & threat protection when it is off.
  • Organizations: set it in the Microsoft Defender portal, Intune or Configuration Manager. A policy wins over the portal, and either wins over the switch in Windows Security.
  • Exclusions: Microsoft's 1 September 2026 report recommends enforcing tamper protection because it blocks exclusion and registry writes. Its documentation protects exclusions only when all of these hold: Defender platform 4.18.2211.5 (November 2022) or later, DisableLocalAdminMerge on, the computer managed only by Intune or only by Configuration Manager with the Defender for Endpoint sensor on, and the exclusions managed there. On a home computer, check the list yourself.
Are exclusions tamper protected on this computer?

TPExclusions is 1 when exclusions are tamper protected and 0 when they are not. Microsoft says to read it only, never change it.

Windows PowerShell, as Administrator
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows Defender\Features' -Name TPExclusions -ErrorAction SilentlyContinue | Select-Object TPExclusions

Update, then scan offline

Windows PowerShell, as Administrator
Update-MpSignature
Get-MpComputerStatus | Select-Object AntivirusSignatureLastUpdated, AntivirusSignatureAge
Start-MpWDOScan
  • Update-MpSignature gets the latest definitions from the sources in SignatureFallbackOrder, or else Microsoft Update, then the Microsoft Malware Protection Center. AntivirusSignatureAge is in days.
  • Start-MpWDOScan restarts into Microsoft Defender Offline, which scans from outside the normal Windows kernel for malware such as rootkits. Microsoft says it takes about 15 minutes, then restarts the computer. Save your work first.
  • Results are under Virus & threat protection, Scan options, Protection history; Scan options, Microsoft Defender Offline scan, Scan now starts the same scan.

Warning Before the offline scan

It needs an administrator, Defender as the active antivirus, and x64 Windows 11 or x64 or x86 Windows 10, not ARM. The Windows Recovery Environment must be on, or Microsoft says nothing happens and no error appears: check with reagentc /info, turn it on with reagentc /enable, as Administrator. If BitLocker protects the system drive, Microsoft says to suspend it first, or you may be asked for the recovery key at restart; know where your recovery key is.

Sources