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.
| Target artifact | Microsoft Defender Antivirus's exclusion lists, ExclusionPath, ExclusionProcess and ExclusionExtension in Get-MpPreference, and its protection state, AMRunningMode, RealTimeProtectionEnabled and IsTamperProtected in Get-MpComputerStatus. |
|---|---|
| Default behaviour | Microsoft 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 state | AMRunningMode 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 Windows | Get-MpComputerStatus | Select-Object AMRunningMode, RealTimeProtectionEnabled, IsTamperProtected |
| Check on Windows | Get-MpPreference | Select-Object ExclusionPath, ExclusionProcess, ExclusionExtension, in PowerShell as Administrator |
| Check in Windows Security | Virus & threat protection, Manage settings, Exclusions, Add or remove exclusions |
| Fix on Windows | Remove-MpPreference -ExclusionPath 'PATH', and -ExclusionProcess or -ExclusionExtension for the other lists, in PowerShell as Administrator |
| Fix in Windows Security | Virus & threat protection, Manage settings, Tamper Protection to On |
Read the result
| Property | Expected | Meaning |
|---|---|---|
AMRunningMode | Normal | Defender 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 |
RealTimeProtectionEnabled | True | Real-time protection is on |
IsTamperProtected | True | Tamper 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 asdat.
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
$p = Get-MpPreference; 'ExclusionExtension','ExclusionPath','ExclusionProcess' | ForEach-Object { $t = $_; $p.$t | ForEach-Object {[pscustomobject]@{Type=$t; Value=$_}} } | Format-Table -AutoSizeWho 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-MpPreferenceto 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
.datextension, 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.
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-Windows Defender/Operational'; Id = 5007, 5013, 5001 } -MaxEvents 50 | Format-List TimeCreated, Id, MessageCompare 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
- Remove what added them first, the remote-access tool, scheduled task or start-up entry, or it may add them back.
- Remove each value exactly as
Get-MpPreferenceprints it;Remove-MpPreferencereports an error for a value not in the list. In Windows Security, select it under Add or remove exclusions, then Remove.
Remove-MpPreference -ExclusionPath 'C:\Users\Public\Example'
Remove-MpPreference -ExclusionProcess 'C:\Example\program.exe'
Remove-MpPreference -ExclusionExtension 'dat'- 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.
$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,
DisableLocalAdminMergeon, 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.
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows Defender\Features' -Name TPExclusions -ErrorAction SilentlyContinue | Select-Object TPExclusionsUpdate, then scan offline
Update-MpSignature
Get-MpComputerStatus | Select-Object AntivirusSignatureLastUpdated, AntivirusSignatureAge
Start-MpWDOScanUpdate-MpSignaturegets the latest definitions from the sources inSignatureFallbackOrder, or else Microsoft Update, then the Microsoft Malware Protection Center.AntivirusSignatureAgeis in days.Start-MpWDOScanrestarts 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.
Related guides and lookups
Sources
- Microsoft Learn: Get-MpComputerStatus
- Microsoft Learn: Microsoft Defender Antivirus in Windows, running modes
- Microsoft Learn: MSFT_MpComputerStatus class
- Microsoft Learn: Get-MpPreference
- Microsoft Learn: Add-MpPreference
- Microsoft Learn: Remove-MpPreference
- Microsoft Learn: configure custom exclusions for Microsoft Defender Antivirus
- Microsoft Learn: Defender configuration service provider
- Microsoft Support: virus and threat protection in the Windows Security app
- Microsoft Learn: tamper protection overview
- Microsoft Learn: configure tamper protection on Windows devices
- Microsoft Learn: protect antivirus exclusions with tamper protection
- Microsoft Support: prevent changes to security settings with Tamper Protection
- Microsoft Learn: Defender Antivirus event IDs
- Microsoft Learn: Update-MpSignature
- Microsoft Learn: Start-MpWDOScan
- Microsoft Learn: Microsoft Defender Offline
- Microsoft Threat Intelligence: malvertising campaign leads to info stealers hosted on GitHub, 6 March 2025
- Microsoft: cryptojacking campaign abusing ScreenConnect, 26 May 2026
- Microsoft: counterfeit installers to system compromise, 1 September 2026
- Microsoft: Octo Tempest, 25 October 2023