Skip to content
SIEMBench
100% Client-Side Tool • Inputs Never Sent to Our Servers

Event ID 4697

Event ID 4697: Service Installed (Security)

A service was installed in the system

Log source
Security
How to enable it
System > Audit Security System Extension (Success)
Category
Persistence
Priority
High
Typical volume
Low
MITRE ATT&CK

T1685 replaces T1562, T1562.001, T1562.006, which older guides still use.

What Event ID 4697 means

4697 reports a new Windows service in the Security log. The System log's 7045 covers the same action without any configuration, so people ask why both are needed. The answer is the subject: 4697 includes the account and its logon session, which 7045 does not.

With that session identifier an analyst can move straight from the service to the network logon that created it, and from there to the source host. In an outbreak that uses PsExec-style execution, this shortens hours of correlation to one join.

The subcategory is not enabled by default. It is low in volume, since new services are rare on a stable system, and turning it on costs almost nothing.

Key fields to inspect

FieldMeaningSuspicious when
ServiceName Internal name of the service. Random letters, PSEXESVC, or a near copy of a Windows service name.
ServiceFileName Program path and arguments. cmd.exe /c, %COMSPEC%, powershell -enc, a share path, or files in Temp and ProgramData.
ServiceType Kind of service, in hexadecimal. 0x1, a kernel driver, from a folder that users can write to.
ServiceStartType When it starts. 2 is automatic and 3 on demand. 3 with an immediate start and removal, which is one-off execution.
ServiceAccount Account it runs under. LocalSystem for an unfamiliar program.
SubjectUserName Who installed it. A user account, or an administrator who was not working.
SubjectLogonId Session that installed it. A type 3 logon from a workstation.

Service type values

ValueTypeReading
0x1Kernel driverCheck the signature. Vulnerable drivers are used to disable protection
0x2File system driverSame concern as kernel drivers
0x10Own processMost common for malicious services
0x20Shared processA DLL hosted by svchost.exe
0x50User service, own processCreated for each user session
0x110Interactive, own processLegacy, and rare on modern systems

Detection queries

Find services whose path uses a shell, a share or a writable folder, with the session that installed them. Adjust names and thresholds to your environment. About these queries.

Splunk SPL

index=windows source="XmlWinEventLog:Security" EventCode=4697
| regex ServiceFileName="(?i)(comspec|cmd(\.exe)?\s+/c|powershell|\\\\127\.0\.0\.1|ADMIN\$|\\\\Temp\\\\|\\\\ProgramData\\\\|\\\\Users\\\\)"
| table _time Computer SubjectUserName SubjectLogonId ServiceName ServiceFileName ServiceType ServiceAccount

Microsoft Sentinel KQL

SecurityEvent
| where EventID == 4697
| where ServiceFileName matches regex @"(?i)(comspec|cmd(\.exe)?\s+/c|powershell|\\\\127\.0\.0\.1|ADMIN\$|\\Temp\\|\\ProgramData\\|\\Users\\)"
| project TimeGenerated, Computer, SubjectUserName, SubjectLogonId, ServiceName, ServiceFileName, ServiceType, ServiceAccount

PowerShell

Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4697; StartTime = (Get-Date).AddDays(-30) } |
  ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
  Select-Object Time, SubjectUserName, ServiceName, ServiceFileName, ServiceAccount | Format-List

Attack scenarios

Remote execution in the style of PsExec

A binary is copied to ADMIN$, a service is created to run it and then removed. The chain on the target is 4624 type 3, 5145 for the file, 4697 and 7045, and 4688 for the program as SYSTEM.

smbexec and Cobalt Strike jump

Impacket's smbexec creates a service for each command, with a path that begins with %COMSPEC% and redirects output to a file. Cobalt Strike uses short random names and a path on ADMIN$.

Bring your own vulnerable driver

A signed but vulnerable driver is installed as type 0x1 to gain kernel access and stop protection. The file name is often random and the folder is user writable.

Investigation checklist

  1. Match SubjectLogonId to 4624 and note the source address.
  2. Collect the program or driver named in ServiceFileName and hash it.
  3. Decode encoded PowerShell in the path.
  4. Search every host for the same service name or path.
  5. Check whether the service still exists, and what it started (4688).

Common benign causes

Event ID 4697 FAQ

What is the difference between 4697 and 7045?

Both report a new service. 7045 is in the System log and needs no audit policy. 4697 is in the Security log, needs the Security System Extension subcategory, and adds the account and logon session that installed the service.

Why is 4697 missing when 7045 is present?

The audit subcategory is probably disabled. Enable Audit Security System Extension for success and check the effective setting with auditpol /get /subcategory.

Does 4697 record driver installation?

Yes. Kernel drivers are services of type 0x1 and appear in the same event, which makes it useful against vulnerable driver attacks.

Techniques follow MITRE ATT&CK® v20.1. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (license). Field names were checked against Microsoft documentation and provider schemas.