Security · Persistence
4697 · A service was installed in the system
Event 4697 is logged in the Security log when a new service is installed, recording the service name, binary path, start type and account. It is the Security-log counterpart of System Event 7045 and is a key signal for PsExec-style remote execution, Cobalt Strike service-based lateral movement and service persistence. Because it is in the Security log, it can be harder for an attacker to clear selectively than the System log.
Where it is logged
Key fields to read
| Field | What it tells you |
|---|---|
| ServiceName | Name of the new service; random 7–16 character names are typical of attack tools. |
| ServiceFileName | Binary path or command the service runs, the most important field to read. |
| ServiceType | e.g. 0x10 own process, 0x1 kernel driver. |
| ServiceStartType | 2 auto start (persistence), 3 demand start (typical of PsExec), 4 disabled. |
| ServiceAccount | Account the service runs as, usually LocalSystem. |
| SubjectUserName | Account that installed the service, the pivot to the source of lateral movement. |
Sample event
EventID: 4697
TimeCreated: 2026-03-14T02:24:35.441Z
Computer: NW-FS-02.northwind.local
SubjectUserName: adm.jlopez
SubjectDomainName: NORTHWIND
SubjectLogonId: 0x5B1C0A9
ServiceName: wXkQpLmz
ServiceFileName: %COMSPEC% /b /c start /b /min powershell -nop -w hidden -enc SQBFAFgA...
ServiceType: 0x10
ServiceStartType: 3
ServiceAccount: LocalSystemHow to triage it
- 1Read
ServiceFileName:cmd /c,%COMSPEC%,powershell -enc,\\ADMIN$\paths,Temp/ProgramDatabinaries andPSEXESVC.exeare high-signal. - 2Pivot on
SubjectLogonIdto the 4624 on the same host to find the source IP and logon type (usually type 3 from another internal host). - 3On the source host, look for 4648 explicit credentials and the tool that initiated the connection; on the target, check 5140/5145 for
ADMIN$andIPC$(svcctl) access. - 4Check prevalence: has this service name or binary been installed on other hosts in the last 24 hours? Fan-out means active lateral movement.
- 5Validate with change management or the software deployment team; escalate any unexplained service, and isolate if the binary is malicious.
Benign vs suspicious
Usually benign
- Software installs and updates (browsers, drivers, AV/EDR agents) during patch windows.
- Legitimate admin use of PsExec (
PSEXESVC) by known IT staff from approved admin hosts. - Deployment tools such as SCCM or RMM agents creating their own services.
Red flags
- Random-looking service names combined with
cmd /cor encoded PowerShell inServiceFileName. - Services pointing to binaries in
C:\Windows\Temp, user profiles or UNC paths. - Installation by a user account outside the IT team, or from a workstation rather than a management server.
- The same new service appearing on many hosts within minutes.
- Kernel driver services (
ServiceType0x1) from unknown vendors, which can indicate vulnerable-driver abuse to kill EDR.
Hunt for it: Splunk & KQL
index=wineventlog EventCode=4697
| search Service_File_Name="*cmd*" OR Service_File_Name="*powershell*" OR Service_File_Name="*\\Temp\\*" OR Service_File_Name="*ADMIN$*"
| table _time, host, Account_Name, Service_Name, Service_File_Name, Service_Start_TypeSecurityEvent
| where TimeGenerated > ago(7d)
| where EventID == 4697
| where ServiceFileName has_any ("cmd", "powershell", "%COMSPEC%", "\\Temp\\", "ADMIN$", "-enc")
| project TimeGenerated, Computer, SubjectUserName, ServiceName, ServiceFileName, ServiceStartType, ServiceAccountField names depend on your add-on and table. More translations in the Splunk vs KQL cheat sheet.
Interview question
“What is the difference between Event 4697 and 7045, and which would you hunt with?”
✓ Strong answer sketch
Both record a new service install. 7045 is in the System log and is enabled by default, while 4697 is in the Security log and only appears if Audit Security System Extension is enabled, but it includes the subject account and logon ID that installed the service. I would hunt with whichever is collected, ideally both, focusing on ServiceFileName containing cmd /c, encoded PowerShell or temp paths. The subject logon ID in 4697 is the bonus, because it lets me jump straight to the 4624 and the source host of the lateral movement.
Frequently asked questions
What does Event ID 4697 mean?
Event ID 4697 means a service was installed on the system, logged in the Security log. It records the service name, ServiceFileName, start type, service account and the account that installed it.
Why am I not seeing Event ID 4697?
4697 requires the Audit Security System Extension advanced audit subcategory, which is off by default. Without it, rely on System Event 7045, which is logged by the Service Control Manager regardless of audit policy.