System · Persistence
7045 · A new service was installed in the system
Logged in the System log by the Service Control Manager whenever a new service is installed on a machine. It is on by default, so it is often the most reliable record of PsExec-style lateral movement, malware persistence and kernel driver loading (ServiceType kernel mode driver).
Where it is logged
Service Control Manager, on the host where the service was installed (endpoint, server or DC). No audit policy needed. The Security-log equivalent is 4697, which requires Audit Security System Extension.Key fields to read
| Field | What it tells you |
|---|---|
| ServiceName | Display name of the new service; random strings or look-alike names are suspicious. |
| ImagePath | Command or binary the service runs; the most important field to read. |
| ServiceType | user mode service or kernel mode driver (drivers can be used to kill EDR). |
| StartType | auto start (persistence), demand start (often used once for remote execution) or disabled. |
| AccountName | Account the service runs as, usually LocalSystem. |
| Security UserID | SID in the event System section of the account that installed the service. |
Sample event
Log Name: System
Source: Service Control Manager
EventID: 7045
TimeCreated: 2026-11-20T23:11:48.077Z
Computer: NW-FIN-WS07.northwind.local
Security UserID: S-1-5-21-3623811015-3361044348-30300820-1450
ServiceName: hXqLmPzw
ImagePath: %COMSPEC% /Q /c echo cd ^> \\127.0.0.1\C$\__output 2^>^&1 > %TEMP%\execute.bat & %COMSPEC% /Q /c %TEMP%\execute.bat & del %TEMP%\execute.bat
ServiceType: user mode service
StartType: demand start
AccountName: LocalSystemHow to triage it
- 1Read
ImagePath:cmd.exe /c,%COMSPEC%,powershell -enc,rundll32,\\127.0.0.1\paths, or binaries inTemp,ProgramDataorADMIN$are red flags. - 2Evaluate
ServiceName: random 8-character names,PSEXESVC, or look-alikes of real services. - 3Identify who installed it (
Security UserID) and correlate with a 4624 type 3 logon and 5140/5145 admin share access just before. - 4Check the binary: hash, signature, prevalence across the fleet, and whether it ran (process tree under
services.exe). - 5For
kernel mode driver, check the driver against known vulnerable driver lists (BYOVD) and look for EDR tampering. - 6Scope across hosts: the same
ImagePathpattern on several machines indicates spreading lateral movement.
Benign vs suspicious
Usually benign
- Software installs and updates (browsers, VPN clients, agents) creating signed services in
Program Files. - IT using legitimate PsExec or remote management tools from an admin host, ideally ticketed.
- Driver updates from hardware vendors.
Red flags
ImagePathrunning%COMSPEC% /Q /c ... \\127.0.0.1\C$\__output(Impacket smbexec pattern) orpowershell -nop -w hidden -enc.- Random-looking
ServiceNamewithdemand start, installed and then deleted within seconds. - Service binaries in user-writable paths (
C:\Users\Public,%TEMP%,C:\ProgramData). - New kernel drivers from unusual paths shortly before security tools stop (7040/7036).
- Service installs on many hosts by one account in a short window (ransomware deployment).
Hunt for it: Splunk & KQL
index=wineventlog EventCode=7045
| eval suspicious=if(match(ImagePath, "(?i)(cmd(\.exe)?\s*/c|%COMSPEC%|powershell|-enc|\\Temp\\|\\ProgramData\\|\\Users\\Public|127\.0\.0\.1)"), 1, 0)
| where suspicious=1
| table _time, host, ServiceName, ImagePath, ServiceType, StartType, AccountName// Sentinel Event table (System log): suspicious service ImagePath values
Event
| where TimeGenerated > ago(7d)
| where EventLog == "System" and Source == "Service Control Manager" and EventID == 7045
| extend Data = parse_xml(EventData).DataItem.EventData.Data
| mv-apply d = Data on (summarize F = make_bag(bag_pack(tostring(d["@Name"]), tostring(d["#text"]))))
| extend ServiceName = tostring(F.ServiceName), ImagePath = tostring(F.ImagePath)
| where ImagePath has_any ("cmd", "COMSPEC", "powershell", "-enc", @"\Temp\", @"\ProgramData\", "127.0.0.1")
| project TimeGenerated, Computer, ServiceName, ImagePath, ServiceType = tostring(F.ServiceType), StartType = tostring(F.StartType)Field names depend on your add-on and table. More translations in the Splunk vs KQL cheat sheet.
Interview question
“Why do SOC analysts rely on 7045 more than 4697 for service installation?”
✓ Strong answer sketch
7045 is written to the System log by the Service Control Manager by default, while 4697 in the Security log requires the Audit Security System Extension subcategory, which is often not configured. Both carry the service name and the binary or command line, so 7045 gives coverage even in poorly audited environments. When I triage it, I focus on the ImagePath: command interpreters, encoded PowerShell, temp paths and \\127.0.0.1\C$ output redirection are classic remote-execution tool patterns. I then correlate it with the preceding network logon and admin-share access to identify the source host.
Frequently asked questions
What is the difference between Event ID 7045 and 4697?
Both record a new service. 7045 is in the System log and enabled by default; 4697 is in the Security log, includes the installing subject, and requires Audit Security System Extension.
Why do some malicious services disappear right after 7045?
Tools like PsExec and Impacket create a service, run one command and delete the service, so 7045 may be the only trace that it existed.