PowerShell Script Execution via Windows Service Creation (Service Control Manager)
Flags service creation/start events where the service ImagePath references PowerShell (powershell/pwsh).
- Product
- windows
- Service
- system
- Author
- oscd.community, Natalia Shornikova (SigmaHQ), DRL 1.1
- Published
- 2020-10-06
- Updated
- 2026-07-31
ATT&CK techniques
ExecutionRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
Identifies Windows Service creation events where the service ImagePath contains PowerShell executables (powershell.exe or pwsh). Creating a service to run a script can provide persistence and allow attackers to execute commands outside normal interactive sessions. Detection relies on System/Service Control Manager event telemetry, specifically EventID 7045, and matches the ImagePath content for PowerShell-related binaries.
Reporting behind it
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: PowerShell Script Execution via Windows Service Creation (Service Control Manager)
id: e43d1654-ed24-40ae-a89d-8d633fe84294
status: test
description: Identifies Windows Service creation events where the service ImagePath contains PowerShell executables (powershell.exe or pwsh). Creating a service to run a script can provide persistence and allow attackers to execute commands outside normal interactive sessions. Detection relies on System/Service Control Manager event telemetry, specifically EventID 7045, and matches the ImagePath content for PowerShell-related binaries.
references:
- https://speakerdeck.com/heirhabarov/hunting-for-powershell-abuse
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/system/service_control_manager/win_system_powershell_script_installed_as_service.yml
author: oscd.community, Natalia Shornikova, Huntrule Team
date: 2020-10-06
modified: 2022-12-25
tags:
- attack.execution
- attack.t1569.002
logsource:
product: windows
service: system
detection:
selection:
Provider_Name: Service Control Manager
EventID: 7045
ImagePath|contains:
- powershell
- pwsh
condition: selection
falsepositives:
- Unknown
level: high
license: DRL-1.1
related:
- id: a2e5019d-a658-4c6a-92bf-7197b54e2cae
type: derived