PowerShell Logging
Also called Script Block Logging, Module Logging, Transcription.
Recording PowerShell commands, scripts, and pipeline activity for audit.
What it is
A set of Windows features that capture PowerShell activity at increasing depth: module logging records pipeline execution, script block logging captures the actual code blocks run (including deobfuscated content), and transcription writes a full session transcript to disk. They are enabled via Group Policy or registry settings.
Where it lives
Microsoft-Windows-PowerShell%4Operational.evtx and Windows PowerShell.evtx, under C:\Windows\System32\winevt\Logs
Why it matters
PowerShell is a favorite tool for living-off-the-land attacks, and script block logging in particular records the real, decoded commands even when an attacker layers on obfuscation. It is one of the highest-value Windows telemetry sources for catching fileless tradecraft.
In practice
A script block log (Event ID 4104) revealing a base64-decoded download cradle that the original command line had hidden behind encoding.
What to look for
- Event 4104 script block logs, including decoded content.
- Module logging event 4103.
- Use of PowerShell version 2, which skips modern logging.
Common mistake
Logging only the command line. Script block logs capture the decoded code that actually ran.
Use it in CyberKit
In the field
Well-known tools where this shows up on the job. They are listed to show the landscape, not as a recommendation.
-
Splunk Enterprise Security Commercial
A SIEM where these logs are searched with SPL and turned into correlation searches.
-
Microsoft Sentinel Commercial
Microsoft's cloud SIEM, queried with KQL and fed by connectors for these log sources.
-
Elastic Security Commercial
A SIEM built on Elasticsearch, with a detection rules library and timeline investigations.
-
Wazuh Open source
An open source platform that collects, decodes and alerts on host and log data.
Read next
- Event Tracing for Windows: The high-speed kernel and user-mode tracing framework underpinning Windows telemetry.
- Antimalware Scan Interface: A Windows API that lets security tools inspect scripts and content at runtime.
- Process Creation Auditing: Logging every new process start, ideally with its full command line.