4105 PowerShell log · Script Block Logging info severity high volume

PowerShell Event ID 4105 — Script block start (first execution)

Start of script block execution logging. Indicates the beginning of a script block that will be logged across one or more 4104 events.

Why event 4105 matters

Use with 4104 to reassemble multi-part script blocks. First 4104 event of a large script.

How to detect it

No standalone alerting. Use to correlate multi-part 4104 events via RunspaceId and ScriptBlockId.

Log source
Microsoft-Windows-PowerShell/Operational
Enable PowerShell Module Logging and Script Block Logging via GPO (Administrative Templates → Windows PowerShell).
Fields to pivot on
ScriptBlockTextPathHostApplication

Detection queries

Starting points — adapt the log source, projected fields and thresholds for your environment.

Sentinel / Defender KQL
Event
| where EventLog == "Microsoft-Windows-PowerShell/Operational" and EventID == 4105   // Script block start (first execution)
// EventData holds: ScriptBlockText, Path, HostApplication
| project TimeGenerated, Computer, RenderedDescription
| sort by TimeGenerated desc
Splunk SPL
index=* sourcetype="WinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode=4105
| stats count earliest(_time) as first_seen latest(_time) as last_seen by ComputerName
| sort - count   `# Script block start (first execution) — add EventData fields: ScriptBlockText, Path, HostApplication`
Hunt event 4105 in Sentinel/Defender →
Build a KQL query for this event in the KQL Query Builder.
Search all event IDs →
Open the interactive Windows Event ID lookup.

Related Script Block Logging events

4104 Script block logging — script block recorded 4106 Script block end (final execution)

Frequently asked questions

What is PowerShell Event ID 4105?

Script block start (first execution). Start of script block execution logging. Indicates the beginning of a script block that will be logged across one or more 4104 events.

Which log records event 4105?

Event 4105 is written to the Microsoft-Windows-PowerShell/Operational channel by Microsoft-Windows-PowerShell. Enable PowerShell Module Logging and Script Block Logging via GPO (Administrative Templates → Windows PowerShell).

How do you detect activity around event 4105?

No standalone alerting. Use to correlate multi-part 4104 events via RunspaceId and ScriptBlockId.