System Event ID 7040: service start type changed
What System Event ID 7040 (service start type changed) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
System Event ID 7040, from the Service Control Manager, records that a service's start type changed, for example from automatic to disabled. Windows does this to its own services all the time, so most 7040s are noise. The ones to catch are security, backup and recovery services being set to disabled, a step most ransomware crews take before encryption so that Defender, the EDR agent and Volume Shadow Copies don't get in the way.
The fields that matter
| Field | What it tells you |
|---|---|
| param1 (service name) | Display name of the service, such as Microsoft Defender Antivirus Service or Volume Shadow Copy. |
| param2 / param3 | Old and new start type: auto start, demand start or disabled. |
| param4 | The service key name, such as WinDefend, VSS or wbengine. |
| System > Security UserID | The account that made the change. SYSTEM is normal for Windows itself; a user account is worth a look. |
What is normal
Background Intelligent Transfer Service (BITS) and Windows Update services flipping between auto start and demand start, driver and software installers, and Group Policy setting service startup.
When System Event ID 7040 is suspicious
- A security or backup service set to disabled:
WinDefend,Sense(Defender for Endpoint),VSS,wbengine,SDRSVC, EDR agents, or backup software such as Veeam. - Several services disabled within a few minutes by the same account.
- A change by an interactive user account rather than SYSTEM or a deployment tool.
- Followed by 7036 (service stopped), shadow copy deletion (
vssadmin delete shadows) or Defender event 5001.
Common false positive: Software installers and hardening scripts often disable services such as Print Spooler or Remote Registry on purpose. Keep a list of services your baseline disables.
Find System Event ID 7040 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='System'; Id=7040; 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 == "System" and EventID == 7040
| project TimeGenerated, Computer, RenderedDescription, EventData
| order by TimeGenerated desc
Related events
- System Event ID 7045: New service installed
- Defender Event ID 5001: Defender real-time protection disabled
- Event ID 4697: Service installed
- Event ID 4688: New process created
FAQ
Why is Event ID 7040 so noisy?
Windows Update and BITS change their own start types routinely. Filter on param4 for the services you care about instead of alerting on every 7040.
Does Event ID 7040 mean the service was stopped?
No, only its start type changed. A stop is logged as 7036. Attackers usually do both, and the service stays off after a reboot.
Which services should I watch for in Event ID 7040?
Defender (WinDefend, WdNisSvc, Sense), your EDR agent, VSS, wbengine, EventLog, backup agents and remote management tools you rely on for response.
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.