PowerShell Logging is the set of Windows features that record PowerShell activity, mainly script block logging, module logging and transcription. Attackers favour PowerShell for fileless execution and obfuscation, and script block logging captures the code as it executes, generating event ID 4104. Enable it, forward the logs centrally, and protect them from tampering.
What PowerShell logging actually records
PowerShell logging is not one feature but a set of Windows telemetry options that record different stages of PowerShell activity. Script block logging captures the code as it runs, module logging records module and command usage, and transcription preserves the interactive text of a session. Together they give defenders visibility into script-based execution that otherwise blends into normal administration.
The practical value is that PowerShell often carries both legitimate administration and attacker tradecraft. Logging gives you a way to distinguish routine automation from suspicious behaviour such as encoded commands, obfuscation, staged downloads or repeated use of high-risk cmdlets. That is why event 4104 is so often treated as a high-signal source for investigation.
Why attackers try to avoid it
PowerShell is attractive because it supports fileless execution, memory-resident behaviour and flexible obfuscation. When logging is absent or incomplete, defenders lose a major source of visibility into what actually executed, not just what was launched. This matters because a single command line often hides a much larger script body, especially when the attacker uses invocation chains, reflective loading or dynamically generated content.
Logging also matters beyond the initial script. Module logging can show which administrative or offensive modules were imported and what functions were called, while transcription can preserve the operator's keystrokes and output. That combination helps close the gap between process creation telemetry and true execution content.
How to read the telemetry in context
PowerShell logs are most useful when read alongside process creation, endpoint detection and Windows auditing data. A script block may be benign on its own, but repeated execution from unusual parent processes, downloads from suspicious locations or commands that disable controls can change the interpretation quickly. The same telemetry can also surface administrative abuse, because attackers frequently live inside tools that are already trusted on the endpoint.
Central forwarding matters because local logs are easy to delete, truncate or overwrite if the endpoint is compromised. Defenders should treat the logging pipeline as part of the control, not a passive storage problem. If the logs are not reliably forwarded and retained, the visibility benefit is lost even when the feature is enabled.
Where PowerShell logging fits in detection and response
PowerShell logging is best understood as a detection enabler rather than a stand-alone defence. It helps analysts reconstruct what executed, identify suspicious script patterns and support post-incident review after a compromise. It is especially valuable when investigating living-off-the-land activity, where the attacker uses built-in tooling instead of dropping a noisy binary.
It also supports hunting for precursor behaviour. For example, repeated script execution, encoding, download cradle patterns and administrative abuse often appear before more destructive actions. In practice, the log becomes most powerful when defenders already know what normal PowerShell use looks like in their environment and can spot the deviations.
Risk and Threat Considerations
PowerShell logging fails when organisations assume that enabling one setting is enough. If transcription is incomplete, script blocks are not forwarded centrally or attackers can tamper with the logging path, the visibility layer becomes unreliable exactly when it is needed most.
Failure mechanism: Attackers exploit PowerShell's flexibility to run obfuscated or fileless commands, then target the logging pipeline itself by disabling settings, clearing logs or forcing execution paths that reduce observability.
Impact: Analysts lose the code-level evidence needed to confirm execution, reconstruct the attack chain and distinguish harmless administration from malicious activity, which can delay containment and post-compromise cleanup.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS-8 — Audit Log Management | PowerShell logging is an audit logging control for endpoint activity. |
| Recommendation — Centralize and retain PowerShell logs so analysts can investigate execution and tampering. | ||
| NIST SP 800-53 Rev 5 | AU-2 — Event Logging | PowerShell logging defines what security events are recorded for later review. |
| AU-6 — Audit Record Review, Analysis, and Reporting | PowerShell telemetry is valuable only when reviewed for suspicious execution patterns. | |
| AU-9 — Protection of Audit Information | PowerShell logs must be protected from deletion and tampering to remain trustworthy. | |
| Recommendation — Define and enable PowerShell events that must be recorded for monitoring and investigation. Review PowerShell logs for suspicious commands, obfuscation and abuse indicators. Protect PowerShell logs from alteration, deletion and unauthorized access. | ||
| MITRE ATT&CK | T1059.001 — PowerShell | PowerShell logging directly supports detection of this command-and-scripting technique. |
| Recommendation — Map PowerShell telemetry to T1059.001 and hunt for malicious script execution. | ||
Practitioner Guidance
What to watch for: Treat script block logging, module logging and transcription as a layered set, not interchangeable options. The strongest deployments preserve content centrally, protect the forwarding path and retain enough history to support both live hunting and retrospective investigation.
Governance implication: Ownership should sit with endpoint and detection teams together, because the value of the telemetry depends on both local configuration and downstream log handling. If the logs are not being queried, retained and protected as security evidence, the control is only partially implemented.
Practitioner takeaway: Use PowerShell logging as a visibility control, then validate that your detection workflow can actually consume the data it produces.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org