Defender Event ID 5007: defender configuration changed
What Defender Event ID 5007 (defender configuration changed) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
Microsoft Defender Event ID 5007 says the antimalware platform configuration changed, with the old and new value of the setting. Most of these are Defender updating itself or a policy arriving from Intune or Group Policy. The ones that matter are new exclusions and protection features being switched off, because adding an exclusion for a folder is the quiet way to make Defender ignore a payload instead of disabling it outright.
The fields that matter
| Field | What it tells you |
|---|---|
| Old Value | The registry path and previous value of the setting, or empty if it is new. |
| New Value | The path and new value, for example HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths\C:\Users\Public = 0x0. |
| Product Version | The Defender platform version, useful when a change follows an update. |
What is normal
Signature and platform updates, Intune or Group Policy settings arriving (paths under SOFTWARE\Policies\Microsoft\Windows Defender), and exclusions documented for backup, database or line-of-business software.
When Defender Event ID 5007 is suspicious
- A new path under
Exclusions\Paths,Exclusions\ProcessesorExclusions\Extensionsthat nobody documented, especially user-writable folders (C:\Users\Public,AppData,Temp,ProgramData) or whole drives. - Exclusions for script extensions (
.ps1,.bat,.vbs) or forpowershell.exeorrundll32.exe. DisableRealtimeMonitoring,DisableBehaviorMonitoring,DisableIOAVProtectionorDisableScriptScanningset to 1.- Changes made outside your management policy path, which points to someone running
Set-MpPreferenceorAdd-MpPreferenceon the machine.
Common false positive: Vendor-recommended exclusions for SQL Server, Exchange or backup software. Record them in your policy so a new local exclusion stands out.
Find Defender Event ID 5007 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Windows Defender/Operational'; Id=5007; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
ForEach-Object {
$d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]$d
} | Format-List
Microsoft Sentinel (KQL)
Event
| where TimeGenerated > ago(7d) and EventLog == "Microsoft-Windows-Windows Defender/Operational" and EventID == 5007
| project TimeGenerated, Computer, RenderedDescription, EventData
| order by TimeGenerated desc
Related events
- Defender Event ID 5001: Defender real-time protection disabled
- Defender Event ID 1116: Defender detected malware
- System Event ID 7040: Service start type changed
- PowerShell Event ID 4104: PowerShell script block logged
FAQ
How do I see which Defender exclusions are set?
Run Get-MpPreference | Select-Object Exclusion* as an administrator. If exclusions are hidden from local admins by policy, check the policy in Intune or Group Policy instead.
What is the difference between Event ID 5007 and 5001?
5001 says real-time protection was turned off. 5007 records any configuration change, including the quieter ones such as exclusions, so it catches more.
Can tamper protection stop these changes?
Tamper protection blocks local changes to many protection settings, but exclusions added by an administrator can still be allowed depending on configuration. Watching 5007 covers the gap.
Windows Event Triage reads a CSV, EVTX-to-JSON or XML export in your browser and flags brute force, new admins, suspicious services and log clearing.
IOC Triage, our free browser extension: right-click it for a verdict from 15 threat-intel sources, then copy a ready ticket note.