About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
Tamper protection exists so that attackers, and well-meaning administrators, cannot quietly turn off the protections that keep a device safe. When something tries to change one of those settings, Defender blocks the change and records event ID 5013. One reason to come looking is a Group Policy change that seemed to apply and did nothing. The event is the record that the change was refused rather than missed.
The sections below explain how to read event 5013, how to prove what attempted the change and whether it was wanted, and the two supported ways to make a change that tamper protection should allow. Nothing before the Fix section changes anything.
What the error means
Microsoft's event page gives event 5013 the message "Tamper protection blocked a change to Microsoft Defender Antivirus." and the description "If Tamper protection is enabled then any attempt to change any of Defender's settings is blocked. Event ID 5013 is generated and states which setting change was blocked." Microsoft's tamper protection troubleshooting page repeats the meaning: tamper protection blocked a change to a Microsoft Defender Antivirus setting, and the event identifies the setting that the attempted action tried to change.
The event page prints the symbolic name MALWAREPROTECTION_SCAN_CANCELLED for 5013. That name reads like a scan event, not a tamper protection event. The message, the description and the troubleshooting page all say tamper protection, so read the event by its message, not by its symbolic name.
Find the event in Event Viewer under Applications and Services Logs > Microsoft > Windows > Windows Defender > Operational. Microsoft's page says to press the Windows logo key + R, type eventvwr.msc, select OK, and use Find and Filter in the Actions pane.
Microsoft's tamper protection overview lists what is protected when tamper protection is enabled on Windows: virus and threat protection stays enabled, real-time protection stays turned on, behaviour monitoring stays turned on, cloud protection stays enabled, security intelligence updates occur, automatic actions are taken on detected threats, archived files are scanned, and exclusions can't be modified or added. It adds that attempts to modify Microsoft Defender Antivirus settings through the registry are blocked. A blocked change to any of these is a candidate for event 5013.
Likely causes
Microsoft's event page does not list causes. Microsoft's other pages show where changes come from, so these are the sources of a blocked change that Microsoft's pages support:
| Source of the attempted change | What Microsoft's pages say |
|---|---|
| Group Policy | Microsoft says that when tamper protection is turned on, "changes made through a management tool, including Group Policy, might appear to succeed, but tamper protection blocks the changes." |
| Intune or Defender portal policy that does not match the protected value | The configuration page sets out which policy takes precedence; proof step 4 quotes it |
| A script or administrator using PowerShell or the registry | Microsoft says registry changes to Defender settings are blocked, and PowerShell cannot configure tamper protection during normal operation |
| An exclusion added or changed | The overview says exclusions can't be modified or added when tamper protection is enabled |
| A default threat action of Allow or None | The Set-MpPreference page says Allow and None can't be configured when tamper protection is enabled |
| Malware or an attacker trying to switch protections off | The overview says "attackers often try to disable security features on devices", and that Defender for Endpoint detects potential attempts |
Microsoft gives no counts, so the order is not an order of likelihood.
Prove the cause before changing anything
All of these steps only read.
-
Open the 5013 event and read which setting was blocked. Microsoft says the event identifies it. Note the time.
-
Find out what was changing settings at that time. Look at your own change record for a Group Policy edit, an Intune policy change, a script run, or a remote session at that time. As general advice, not a Microsoft step, ask the person who made the change what setting they expected to change.
-
Check whether tamper protection is on. Microsoft's command is read-only:
Get-MpComputerStatus | Select-Object IsTamperProtected
Microsoft says True means the setting is enabled. On some Windows versions the Windows Security app does not show whether tamper protection is enabled, including Windows Server 2016, Windows Server 2019 and Windows 10 version 1809, so rely on the command.
-
Work out which policy controls tamper protection. Microsoft's configuration page says "A policy that manages tamper protection takes precedence over the organization-wide setting in the Microsoft Defender portal", and that a policy or portal setting also takes precedence over a setting a local administrator configures in the Windows Security app. In Intune the setting is Tamper protection (device) in the Defender section of a Windows Security Experience profile. In the Defender portal it is the Tamper protection toggle on the Advanced features page.
-
If the device is onboarded to Defender for Endpoint, check for tampering alerts. Microsoft says tampering activity can appear on the Alerts page of the Defender portal, and that tampering events are in the DeviceEvents table. Microsoft's query for them is:
DeviceEvents | where Timestamp > ago(10d) | where ActionType == "TamperingAttempt"
- Read the events either side of the 5013 in the same log. Microsoft's event page lists 5004 ("The real-time protection configuration changed."), 5007 ("The antimalware platform configuration changed.") and 5001 ("Real-time protection is disabled."). Together they show whether anything changed around the blocked attempt.
An illustrative example, not from Microsoft: an administrator edits "Turn off real-time protection" in a Group Policy object on Monday. The policy shows as applied on the server, yet real-time protection never stops and 5013 events are logged. The reading is that tamper protection is on and the change is being refused as designed.
Fix
Decide first whether the blocked change was wanted. If it was not, the event is working as intended. Find who or what attempted it, treat an unexplained attempt as a possible security incident, and do not weaken tamper protection to make the event stop.
If the change was wanted, Microsoft documents two routes: a permanent change in a tool that is allowed to change protected settings, and a temporary change through troubleshooting mode.
Route 1: change the policy that manages the setting
Microsoft says that to make permanent changes, you adjust the tamper protection policy or exclude the affected devices from tamper protection through Intune or Configuration Manager. Microsoft's tamper protection configuration page says Configuration Manager does not configure tamper protection directly, and that tenant attach deploys the setting from the Intune admin center.
Before changing the policy, record its current state: the policy name, the value of Tamper protection (device), and which groups it is assigned to or excludes. The page gives no command for this, so it is general advice, and the record is what lets you put the policy back exactly.
Risk: the next step changes tamper protection or its assignment for every device in the scope of the policy. Removing a device from tamper protection leaves that device without it, and an attacker or a mistake can then change the protected settings on it. Make the change for the smallest group that needs it.
In Intune, use an endpoint security Antivirus policy with the Windows Security Experience profile, and set Tamper protection (device) as needed, or exclude specific groups from the assignment. Microsoft says you can assign the policy to your entire organisation or to selected user or device groups, and exclude specific groups.
To undo it: putting the recorded state back can remove tamper protection from devices that now have it, if the earlier state did not include them. Set Tamper protection (device) and the assignments back to the state you recorded.
Route 2: use troubleshooting mode for a temporary change
Troubleshooting mode lets you temporarily change tamper-protected settings on a device. It is for diagnosis, not for a permanent change. Before turning it on, record the current state with the read-only command from the proof section (the IsTamperProtected line). Microsoft also says a snapshot of MpPreference is taken before troubleshooting mode begins and a second one just before it expires.
Disruptive step: the next steps turn on troubleshooting mode for one device in the Defender portal, and then turn tamper protection off on that device. Microsoft says temporarily disabling tamper protection can increase security risk, that the device must be online, and that local administrators can change other Defender settings while the mode is active. It also says changes delivered through management policies while the mode is active don't take effect until it expires, and that platform updates are not applied while it is active. It automatically turns off after four hours and is limited to eight hours per device. The sections of the page that describe turning it on describe no way to end it early.
In the Microsoft Defender portal, go to the Device inventory page, select the device row anywhere except the check box, select More options (...) on the device details page, select Turn on troubleshooting mode, and then select Submit in the confirmation flyout. Wait for the device details page to show that troubleshooting mode is active, which Microsoft says can take up to 15 minutes. Microsoft says the Turn on troubleshooting mode option appears for every device, even one that does not meet the prerequisites.
Then, in an elevated PowerShell session (a window started by selecting Run as administrator), Microsoft's command is:
Set-MPPreference -DisableTamperProtection $true
Microsoft says the command works only while the device is in troubleshooting mode. To check, run the read-only command from earlier: the value False confirms tamper protection is off. Make the change you need, then stop. Do not leave the mode running longer than the work needs.
To undo it: you do not need to turn tamper protection back on. Microsoft says that when troubleshooting mode expires, the temporary change is discarded and tamper protection returns to its previous policy-managed state. The sections of Microsoft's page that describe turning troubleshooting mode on do not describe ending it early, so plan for the four-hour limit.
Confirm the fix
- If you changed a policy, the 5013 events stop for that setting and the setting shows the new value on the device after the policy applies.
Get-MpComputerStatus | Select-Object IsTamperProtectedreads True again after troubleshooting mode ends, if tamper protection was on before.- In the Defender portal's Device Timeline, the start and end of troubleshooting mode are listed. Microsoft says the Operational log can also show events 5000, 5001, 5004 and 5007 while it is active.
- No new "TamperingAttempt" events appear in the DeviceEvents query for the device.
What to watch afterwards
- Repeated 5013 events for the same setting. Something keeps trying, such as a policy that conflicts with tamper protection.
- Event 5007, "The antimalware platform configuration changed.", which records a configuration change with old and new values.
- Event 5001, "Real-time protection is disabled.", if real-time protection is the setting being attacked.
- Devices where tamper protection shows as Not applicable. Microsoft says this happens when a device is not onboarded to Defender for Endpoint and tamper protection is configured through Intune or the Defender portal.
- Troubleshooting mode use. Microsoft provides advanced hunting queries that list devices currently in troubleshooting mode.
Read next
Related articles you may want next.
- TroubleshootingGroup Policy Not Applying: gpresult, Events and SYSVOLA Group Policy setting missing on a hosted server: read gpresult as the affected user, check loopback, filter one run's events, then check SYSVOL state.Read article
- Troubleshooting"Windows failed to apply the MDM Policy settings" after gpupdate /force on an Intune-enrolled hybrid devicegpupdate /force warns Windows failed to apply the MDM Policy settings on an Intune device? Microsoft calls it expected when enrolled. How to prove it.Read article
- Backup & RecoveryControlled folder access is blocking the backup software: event 1123 and how to allow the appControlled folder access blocks your backup agent with event 1123. Find the program and folder, allow the app by path, and keep ransomware protection on.Read article
Risks and limits
These steps were researched from Microsoft's pages and have not been run or lab-tested.
Microsoft's event page gives no field list for 5013 beyond the statement that it identifies the setting, and no causes. The cause table combines Microsoft's statements from several pages. The Intune and Defender portal paths were current on Microsoft's pages dated 2026-09-08 and 2026-09-09 and portal labels change, so check the current pages before acting. Troubleshooting mode lowers protection on the device while it runs, and the sections of Microsoft's page that describe turning it on give no way to end it early. Where Group Policy shows a successful edit but the device does not change, tamper protection is one possible reason, not a certain one.
Sources
- Review event logs and error codes to troubleshoot issues with Microsoft Defender Antivirus — Microsoft Learn, page dated 2026-06-01, accessed 3 December 2026
- Troubleshoot problems with tamper protection — Microsoft Learn, page dated 2026-09-09, accessed 3 December 2026
- Tamper protection overview — Microsoft Learn, page dated 2026-09-09, accessed 3 December 2026
- Configure tamper protection for Microsoft Defender Antivirus on Windows — Microsoft Learn, page dated 2026-09-08, accessed 3 December 2026
- Enable and use troubleshooting mode in Microsoft Defender for Endpoint — Microsoft Learn, page dated 2026-09-08, accessed 3 December 2026
- Set-MpPreference — Microsoft Learn cmdlet reference, no update date shown on the page, accessed 3 December 2026
This article was originally published on .