1. Resources
  2. Detection sources
  3. Event ID 4697

Event ID 4697: A service was installed in the system

Written when a service is installed, with the installing account, the program it runs, its type, start type and run-as account. On a domain controller, a service installed by a named account points to remote execution.

Log source
Windows Security log
Detection value
Supporting
Volume
Low
Last updated
Audit subcategory
Audit Security System Extension (System, Success)
Logged on
All Windows computers
Event versions
0, 1
Detects
1 attack (1 rule · 1 detection logic)
MITRE ATT&CK
2 techniques in 3 tactics
Threat groups
68 groups that MITRE ATT&CK records using these techniques
Fields the rules read
SubjectUserName

When it is written

Windows writes 4697 when a new service is registered with the Service Control Manager, on the computer that gets the service, if Audit Security System Extension is on for Success. It names the account that installed the service, the program the Service Control Manager will run (with its arguments), the service type and start type, and the account the service will run as.

It is written at installation only. Microsoft notes that a later change to the program path or to the service account is not logged by this event. Microsoft's page lists Windows Server 2016 and Windows 10 as the first versions that write it.

How to turn it on

Advanced audit policy subcategory Audit Security System Extension, Success. Set it in a Group Policy object linked to the computers that write the event:

Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > System > Audit Security System Extension
Microsoft's recommendation per computer role
ComputerAuditNote
Domain controllersSuccessRecommended in both baselines, mainly for event 4697 (a service was installed). The other events are useful only against an allowlist of approved authentication, notification and security packages and logon processes. The subcategory has no failure events.
Member serversSuccessRecommended in both baselines, mainly for event 4697 (a service was installed). The other events are useful only against an allowlist of approved authentication, notification and security packages and logon processes. The subcategory has no failure events.
WorkstationsSuccessRecommended in both baselines, mainly for event 4697 (a service was installed). The other events are useful only against an allowlist of approved authentication, notification and security packages and logon processes. The subcategory has no failure events.
Check the current setting
auditpol /get /subcategory:"Security System Extension"
Based on vendor documentation.
Turn it on (local policy; a domain GPO overrides it)
auditpol /set /subcategory:"Security System Extension" /success:enable
Based on vendor documentation.
The same on a Windows in another display language
auditpol /get /subcategory:"{0CCE9211-69AE-11D9-BED3-505054503030}"
Based on vendor documentation.

Run the commands in an elevated prompt on a computer that writes the event. Subcategory settings take effect only when the security option Audit: Force audit policy subcategory settings (Windows Vista or later) to override audit policy category settings is enabled (the default), and a Group Policy object that sets advanced audit policy replaces local changes at its next refresh. Microsoft's advanced audit policy reference

Fields

In Event Viewer order. The field names are those of the event XML, from the event template that ships with Windows.

FieldWhat it holdsSince
Security IDSubjectUserSidSubjectSID of the account that installed the service. Event Viewer shows it resolved to an account name when it can. S-1-5-18 when a process running as Local System installed it.v0
Account NameSubjectUserNameSubjectRead by 1 ruleName of that account. For Local System it is the computer account, a name that ends with $. The rule reads it.v0
Account DomainSubjectDomainNameSubjectDomain of the installing account, usually as a NetBIOS name, the computer name for a local account, or NT AUTHORITY for well-known principals.v0
Logon IDSubjectLogonIdSubjectHexadecimal ID of the installer's logon session. It matches the Logon ID of the 4624 event on the same computer, whose logon type and source address show how and from where the installation was made.v0
Service NameServiceNameService InformationName of the new service.v0
Service File NameServiceFileNameService InformationPath the Service Control Manager runs to start the service, with any arguments, as given at installation. It can contain environment variables such as %windir%. A later change of the path is not logged here.v0
Service TypeServiceTypeService InformationType of service, in hexadecimal. 0x10 own process, 0x20 share process, 0x1 kernel driver, 0x2 file system driver, 0x8 recognizer driver, 0x110 and 0x120 interactive services.v0
Service Start TypeServiceStartTypeService InformationWhen the service starts. 0 boot, 1 system (both for drivers), 2 automatic (also automatic delayed), 3 manual, 4 disabled.v0
Service AccountServiceAccountService InformationAccount the service will run as, as configured at installation. Filled in only for Win32 services; drivers have none. Local System when no account was given. A later change is not logged here.v0
ClientProcessStartKeyStart key of the client process behind the installation. A start key identifies one run of a process and, unlike a process ID, is not reused (Microsoft describes start keys as unique across boot sessions). Not documented for this event. Version 1.v1
ClientProcessIdID of that client process, in decimal. Not documented for this event. Version 1.v1
ParentProcessIdID of the parent of that client process, in decimal. Not documented for this event. Version 1.v1

Event versions

The Windows template has two versions. Version 0 has the nine fields Microsoft's event page documents. Version 1 adds three fields about the client process behind the installation (ClientProcessStartKey, ClientProcessId, ParentProcessId). Microsoft's page does not document version 1, and Event Viewer's message does not show these fields; they are in the event XML.

  • Version 0: 9 fields
  • Version 1: 12 fields, adds ClientProcessStartKey, ClientProcessId, ParentProcessId

Values to know

Account Name SubjectUserName

ValueMeaningSignal
Ends with $The computer account, for an installation by a process running as Local SystemSoftware installers and agents. The rule leaves these out, so a service created by code already running as Local System is not reported here.Expected
Any other accountA named account installed the serviceWhat an administrator, or an attacker with administrator credentials, leaves when creating a service by hand or from another computer. Reported by the rule on domain controllers.Attack signal

Service Type ServiceType

ValueMeaningSignal
0x10Win32 own processA service in a process of its own. The most common type.Expected
0x20Win32 share processA service sharing a process with others.Expected
0x1Kernel driverStarts early with almost unlimited access to the system. Microsoft recommends reporting all driver installations; they are rare.Attack signal
0x2 or 0x8File system or recognizer driverSame as 0x1.Attack signal
0x110 or 0x120Interactive own or share processA service that can interact with the desktop.Worth knowing

Service Start Type ServiceStartType

ValueMeaningSignal
2Automatic (or automatic delayed)Starts with the system. Most services are installed this way.Expected
3ManualStarts only when something asks for it.Worth knowing
4DisabledMicrosoft notes that installing a service disabled is not common.Worth knowing
0 or 1Boot or system startUsed by drivers. Microsoft recommends reporting them.Attack signal

Service Account ServiceAccount

ValueMeaningSignal
localSystemThe Local System accountAlso used when no account was given. The spelling follows what the installer passed.Expected
localService or networkServiceThe low-privilege service accountsExpected
A user accountThe service runs as a domain or local userMicrosoft recommends reporting every service account other than localSystem, localService and networkService.Worth knowing

Volume and noise

Microsoft rates Audit Security System Extension Low. Most 4697 events come from software installation and updates: Windows components, drivers and agents registering their services, usually under Local System, so the subject is the computer account (a name ending with $). Administrators installing software by hand, and remote administration that creates a temporary service to run a command, add events under named accounts.

Keeping it manageable

  • Keep every 4697: the volume is low, and the rule needs only the event ID and SubjectUserName.
  • The rule leaves out installations by computer accounts. Allow-list the named accounts of your software deployment by SubjectUserName and ServiceFileName together, not by account alone, so that a misused deployment account still stands out.
  • Rank rather than drop: Microsoft recommends reporting every driver type (ServiceType 0x1, 0x2, 0x8), every boot, system or disabled start type (ServiceStartType 0, 1, 4), every program outside %windir% and the Program Files folders, and every service that runs as a user account.
  • Keep the subject's SubjectLogonId: it links the installation to its logon event (4624), which tells whether the service was installed over the network and from which address.

Sample event

Version 1, with made-up values.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-a5ba-3e3b0328c30d}" />
    <EventID>4697</EventID>
    <Version>1</Version>
    <Level>0</Level>
    <Task>12289</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8020000000000000</Keywords>
    <TimeCreated SystemTime="2026-11-18T09:30:12.4567890Z" />
    <EventRecordID>1048576</EventRecordID>
    <Correlation />
    <Execution ProcessID="712" ThreadID="2408" />
    <Channel>Security</Channel>
    <Computer>DC01.corp.example.com</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="SubjectUserSid">S-1-5-21-1004336348-1177238915-682003330-1104</Data>
    <Data Name="SubjectUserName">alice</Data>
    <Data Name="SubjectDomainName">CORP</Data>
    <Data Name="SubjectLogonId">0x5d3a41</Data>
    <Data Name="ServiceName">ExampleBackupAgent</Data>
    <Data Name="ServiceFileName">"C:\Program Files\Example\BackupAgent\agent.exe" --service</Data>
    <Data Name="ServiceType">0x10</Data>
    <Data Name="ServiceStartType">2</Data>
    <Data Name="ServiceAccount">localSystem</Data>
    <Data Name="ClientProcessStartKey">3940649673949285</Data>
    <Data Name="ClientProcessId">4120</Data>
    <Data Name="ParentProcessId">3876</Data>
  </EventData>
</Event>

Attacks this event reveals

Detection rules that read this event:

Frequently asked questions

What is the difference between 4697 and System log event 7045?

Both record a new service with its name, program, type, start type and account. 7045 is written to the System log by the Service Control Manager. 4697 is a Security log event, needs Audit Security System Extension, and carries the installing account and its logon session in its data fields, which link it to the logon event.

Why does the rule ignore services installed by computer accounts?

Installations by processes running as Local System, such as software installers and agents, show the computer account as subject and make up most of the volume. What remains are services created by a named account, which is what manual and remote installations produce. A service created by code that already runs as Local System is therefore not reported by this rule.

Does 4697 record changes to an existing service?

No. It is written when the service is installed. Microsoft notes that a later change to the program path or to the service account is not logged by this event.

Which 4697 values deserve attention?

Microsoft recommends reporting driver services (type 0x1, 0x2 or 0x8), boot, system and disabled start types (0, 1, 4), programs outside the Windows and Program Files folders, and services that run as user accounts. On a domain controller, any service installed by a named account deserves a look.

References