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.
Event ID 5007 appears in the Windows Defender Operational log whenever a Microsoft Defender Antivirus setting changes. It is a good event for an administrator to notice, because a changed antivirus setting is exactly what an attacker or a bad policy produces. It is also a frustrating event, because it shows an old and a new value and nothing else: no user and no process, and Microsoft's event page does not say how to read the values.
The sections below show how to work out which setting changed and what changed it by using the events around 5007, the current setting values, and the management tools that can change them, and how to put a setting back when the change was not wanted. Nothing before the Fix section changes anything.
What the error means
Microsoft's event page gives event 5007 the symbolic name MALWAREPROTECTION_CONFIG_CHANGED and the message "The antimalware platform configuration changed." Its description reads "Microsoft Defender Antivirus configuration changed. If this event is unexpected, you should review the settings as the event might be the result of malware." The two fields are listed as "Old value: Old value number Old antivirus configuration value." and "New value: New value number New antivirus configuration value."
That is the whole entry. The page gives no key that turns a configuration value number into a setting name, and no "User action" text.
Microsoft's offline-scan page shows what a 5007 can look like in practice. Its example for the offline scan reads "Old value: N/A\Scan\OfflineScanRun =" and "New value: HKLM\SOFTWARE\Microsoft\Windows Defender\Scan\OfflineScanRun = 0x0". In that example the values carry a registry path and a value name, so the setting is named in the event itself. Microsoft's migration page shows a second example, "Old value: Default\IsServiceRunning = 0x0" and "New value: HKLM\SOFTWARE\Microsoft\Windows Defender\IsServiceRunning = 0x1", where Defender was turned off because a non-Microsoft antivirus was installed. Neither page says that every 5007 prints a path, so read the two fields in your own event first. Where they hold only numbers, the event tells you that something changed and when, and the rest has to come from other sources. In neither case does the event name a user or a process.
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 page lists several nearby events that say more about what changed:
| Event | Message on Microsoft's page |
|---|---|
| 5004 | "The real-time protection configuration changed." It lists a Feature and a Configuration |
| 5000 and 5001 | "Real-time protection is enabled." and "Real-time protection is disabled." |
| 5009 | "Scanning for malware and other potentially unwanted software is enabled." |
| 5010 | "Scanning for malware and other potentially unwanted software is disabled." |
| 5011 | "Scanning for viruses is enabled." |
| 5012 | "Scanning for viruses is disabled." |
| 5013 | "Tamper protection blocked a change to Microsoft Defender Antivirus." |
Likely causes
Microsoft's event page names one cause to rule out: malware. The other causes are the ordinary ways Defender settings are changed, and Microsoft's pages list them.
| Source of the change | Where Microsoft's pages describe it |
|---|---|
| A Group Policy setting under Computer configuration > Administrative templates > Windows components > Microsoft Defender Antivirus | The always-on protection and update source pages |
| An Intune or Defender portal endpoint security policy, or Configuration Manager | The always-on protection page |
| A mobile device management (MDM) policy or Windows Management Instrumentation (WMI) | The update source page names the MSFT_MpPreference class and the Policy CSP |
| A PowerShell session using Set-MpPreference | The always-on protection page and the Set-MpPreference page |
| A person using the Windows Security app | The always-on protection and tamper protection pages |
| Troubleshooting mode | Its page says events might include 5000, 5001, 5004 and 5007 |
| Malware or an attacker | The 5007 description |
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.
-
Write down the time of the event and the two values. Read the Old value and New value fields exactly as they appear, and check whether they hold a registry path and value name as in the offline-scan example above. They are the only direct trace of the change.
-
Read the events either side of it in the same log. A 5004 within the same minute carries a Feature and a Configuration, which is more readable than the two numbers. A 5001, 5010 or 5012 shows protection being turned off, and a 5013 shows tamper protection blocking a change.
-
Read the current values of the settings. Microsoft's cmdlet page gives this read-only command, which returns the preferences for Windows Defender scans and updates:
Get-MpPreference
Microsoft's always-on protection page also gives a focused read-only form for three settings:
Get-MpPreference | Select-Object DisableRealtimeMonitoring, DisableBehaviorMonitoring, RealTimeScanDirection
As general advice, not a Microsoft step, run the same command on a similar device that did not log a 5007 and compare the two outputs. A difference points at the setting that changed.
- Check the state of tamper protection. Microsoft's command is read-only:
Get-MpComputerStatus | Select-Object IsTamperProtected, RealTimeProtectionEnabled
Microsoft says that when tamper protection is on, protected settings can't be changed and that changes made through a management tool, including Group Policy, might appear to succeed but are blocked. Our reading, not Microsoft's statement: a 5007 on a device with tamper protection on is then a change to a setting that is not protected, or a change made by something allowed to make it.
-
Ask what could have changed it. Look at your own change record for a Group Policy edit, an Intune or Configuration Manager policy change, a script, or a remote session at that time. Microsoft's tamper protection page says a policy that manages tamper protection takes precedence over the organisation-wide setting in the Defender portal, so more than one tool can be involved.
-
If the device is onboarded to Defender for Endpoint, look at the portal. Microsoft says tampering activity can appear on the Alerts page and in the DeviceEvents table, and gives this query:
DeviceEvents | where Timestamp > ago(10d) | where ActionType == "TamperingAttempt"
- Check whether troubleshooting mode was active. Microsoft says the Device Timeline in the Defender portal shows when it started and ended, and that a snapshot of MpPreference is taken before it begins and another just before it expires. Those snapshots are in the investigation package you can collect from the device page, which lets you compare the settings before and after.
An illustrative example, not from Microsoft: a 5007 appears on a file server at 03:12 with a 5004 for the same minute. Get-MpPreference on that server differs from the output on a sister server in one setting, and a Group Policy object was linked to the server's organisational unit at 03:00. The reading is that the policy refresh changed the setting and that the change was expected.
Fix
Decide first whether the change was expected. If your change record explains it, there is nothing to fix. Write the time, the two values and the explanation next to the event, because the numbers will mean little in a month.
If the change was not expected, Microsoft says the event might be the result of malware, so treat the device as a possible security incident first: confirm that real-time protection is still on with the read-only command from the proof section, keep a copy of Get-MpPreference output, and look at the other events and alerts for the same time. As general advice, not Microsoft's, do not put the setting back until you have kept that record, because putting it back removes the current values.
Once the change is understood, the setting is restored through the tool that owns it, in the step below. A policy that sets the value will set it again, so changing it by hand on one device is the wrong fix when a policy is the cause.
Before changing anything, record the present state. For a Group Policy, Intune, Defender portal or Configuration Manager policy, note the policy name, the setting, whether it is Not Configured, Enabled or Disabled, and its options. For a single device, keep the output of the Get-MpPreference line from the proof section. Microsoft's pages give no further command for this, so it is general advice, and the record is what lets you put things back exactly.
Risk: the next step changes a Defender setting, and if the setting sits in a policy it changes it for every device in the scope of that policy. A wrong value can switch protection off or leave devices with a setting nobody expects. Make the change on one test device or group first. If tamper protection is on, Microsoft says changes to tamper-protected settings are ignored, so a change that looks like it worked may not have taken effect.
Open the policy or setting that owns the value, in the tool you identified in the proof section, and set it to the intended value. For real-time protection settings Microsoft's always-on protection page lists the values and the tools, and for the update source settings its update source page does. For a single device with no policy, Microsoft's Set-MpPreference page lists the parameters, and its always-on protection page gives the real-time protection example Set-MpPreference -DisableRealtimeMonitoring $false -DisableBehaviorMonitoring $false -RealTimeScanDirection Both.
To undo it: this puts back the value the unwanted change had replaced, which if that value is the one that was changed maliciously or in error brings the problem back, and it can switch a protection off again. Put the policy or setting back to the state and values you recorded.
Confirm the fix
- The setting shows the intended value, read with Get-MpPreference or in the policy.
- No new 5007 appears for the same setting. A new one means something is changing it again.
- If a real-time setting was involved, event 5000 appears and
Get-MpComputerStatus | Select-Object IsTamperProtected, RealTimeProtectionEnabledshows RealTimeProtectionEnabled as True. - Event 1151, the client health report, lists the RTP, OA, IOAV and BM states as Enabled or Disabled, which gives a second read of the state.
What to watch afterwards
- Repeat 5007 events. A change that repeats may have a repeating source, such as a policy refresh or a script on a schedule.
- Event 5013. Microsoft says it states which setting change was blocked.
- Tampering alerts and the DeviceEvents "TamperingAttempt" query for devices in Defender for Endpoint.
- Use of troubleshooting mode. Microsoft provides advanced hunting queries that list devices currently in troubleshooting mode.
- Any 5007 that nobody can account for. Microsoft's own wording is that it might be the result of malware.
Read next
Related articles you may want next.
- TroubleshootingWindows event logs: retention, forwarding and keeping the evidence an investigation needsHow long Windows event logs last by default, why they overwrite, and how forwarding and size settings keep evidence for an investigation.Read article
- 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
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 key for the two values in event 5007, and the event does not name the user or process that made the change. The only thing it proves is that a change happened at that time. The advice to compare against a similar device and to keep a record before restoring is general advice. A setting changed by a policy will be changed again by the policy, so changing it by hand can hide the cause. An unexplained 5007 might be nothing, and Microsoft's page says it might be malware, so take it seriously until the source is known.
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
- Enable and configure Microsoft Defender Antivirus always-on protection — Microsoft Learn, page dated 2026-09-02, 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
- Run and review the results of a Microsoft Defender Offline scan — Microsoft Learn, page dated 2026-07-03, accessed 3 December 2026
- Troubleshoot Microsoft Defender Antivirus while migrating from a non-Microsoft solution — Microsoft Learn, page dated 2026-04-19, accessed 3 December 2026
- Manage the sources for Microsoft Defender Antivirus protection updates — Microsoft Learn, page dated 2026-08-13, accessed 3 December 2026
- Get-MpPreference — Microsoft Learn cmdlet reference, no update date shown on the page, 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 .