powershell-logging
Skill0 starsChanged 29 days agoMITView on GitHub
Enable and analyze PowerShell telemetry — script block logging (4104), module logging (4103), transcription, AMSI — to detect encoded commands, download cradles, obfuscation and downgrade attacks. Use when investigating malicious PowerShell, reviewing logging configuration, or writing PowerShell detections.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- fadwen/ai-powershell-standardstheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- fadwen/ai-powershell-standards★ 24same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository273 other files it gives its agents.
- ad-attack-path-analysisSkill
- adcs-security-reviewSkill
- ad-privileged-access-reviewSkill
- dcsync-detectionSkill
- gpo-security-reviewSkill
- kerberos-attack-detectionSkill
- agent-tool-permission-reviewSkill
- ai-incident-responseSkill
- llm-gateway-controlsSkill
- llm-security-evaluationSkill
- mcp-server-security-reviewSkill
- model-artifact-securitySkill
- prompt-injection-reviewSkill
- rag-security-reviewSkill
- api-abuse-detectionSkill
- api-authorization-testingSkill
- api-inventorySkill
- api-schema-securitySkill
- dast-baselineSkill
- sast-triageSkill
- sca-dependency-riskSkill
- secure-code-reviewSkill
- security-requirementsSkill
- threat-modelingSkill
- asset-criticality-tieringSkill
- asset-inventory-reconciliationSkill
- external-attack-surface-reviewSkill
- shadow-it-discoverySkill
- aws-credential-compromiseSkill
- aws-iam-reviewSkill
- aws-org-guardrailsSkill
- cloudtrail-investigationSkill
- guardduty-triageSkill
- s3-exposure-reviewSkill
- azure-activity-investigationSkill
- azure-rbac-reviewSkill
- conditional-access-reviewSkill
- entra-audit-investigationSkill
- entra-signin-investigationSkill
- backup-assuranceSkill
- critical-service-mappingSkill
- ransomware-recoverySkill
- recovery-exerciseSkill
- cloud-exposure-reviewSkill
- cloud-incident-responseSkill
- cloud-logging-baselineSkill
- cloud-posture-assessmentSkill
- audit-evidence-packageSkill
- continuous-control-monitoringSkill
- control-mappingSkill
- control-testing-samplingSkill
- container-incidentSkill
- dockerfile-hardeningSkill
- image-scanningSkill
- runtime-detection-falcoSkill
- db-audit-loggingSkill
- db-exfiltration-investigationSkill
- db-hardeningSkill
- db-privilege-reviewSkill
- data-classificationSkill
- The first 60 shown.
The file
Files
PowerShell Logging and Analysis
Enable (GPO: Administrative Templates → Windows Components → Windows PowerShell)
| Setting | Event | Value |
| Turn on PowerShell Script Block Logging | 4104 in Microsoft-Windows-PowerShell/Operational | Decoded, deobfuscated script content at execution |
Turn on Module Logging (*) | 4103 | Pipeline execution details |
| Turn on PowerShell Transcription | Text files | Full session I/O; write to a protected share |
| Protected Event Logging (optional) | — | Encrypts 4104 content with a certificate |
PowerShell 5+ automatically logs "suspicious" script blocks at Warning level even without the policy. PowerShell 7 logs to PowerShellCore/Operational.
What to hunt in 4104/4688
- Encoded commands:
-enc,-EncodedCommand,-ewith long base64; decode:[Text.Encoding]::Unicode.GetString([Convert]::FromBase64String($b64)). - Download cradles:
IEX,Invoke-Expression,DownloadString,DownloadFile,Net.WebClient,Invoke-WebRequest ... | iex,Start-BitsTransfer. - AMSI bypass strings:
AmsiUtils,amsiInitFailed,AmsiScanBufferpatching. - Defender tampering:
Set-MpPreference -DisableRealtimeMonitoring $true,Add-MpPreference -ExclusionPath. - Downgrade:
powershell.exe -version 2(bypasses script block logging; remove the PowerShell v2 feature). - Credential tools:
Invoke-Mimikatz,sekurlsa,Get-GPPPassword,Invoke-Kerberoast. - Large script blocks are split across multiple 4104 events (
MessageNumber/MessageTotal, sameScriptBlockId) — reassemble before analysis.
Queries
Sentinel (MDE): DeviceProcessEvents | where FileName in~ ("powershell.exe","pwsh.exe") and ProcessCommandLine matches regex @"(?i)\s-(e|en|enc|enco|encod|encode|encoded|encodedc|encodedcommand)\s+[A-Za-z0-9+/=]{40,}"
Splunk: index=wineventlog source="XmlWinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode=4104 (ScriptBlockText="*DownloadString*" OR ScriptBlockText="*AmsiUtils*")
Sigma example
title: PowerShell Script Block With AMSI Bypass Strings
id: 2b6f0c8e-9d3f-4c55-8c0f-6f1f0a8f3b21
status: experimental
description: Detects script blocks referencing AMSI bypass primitives.
references:
- https://learn.microsoft.com/en-us/windows/win32/amsi/antimalware-scan-interface-portal
author: Claude-Blue
date: 2026-10-31
tags:
- attack.defense-impairment
- attack.t1685
logsource:
product: windows
category: ps_script
detection:
selection:
ScriptBlockText|contains:
- 'AmsiUtils'
- 'amsiInitFailed'
- 'AmsiScanBuffer'
condition: selection
falsepositives:
- Security tooling and research scripts
level: highRelated skills
script-deobfuscation, windows-event-log-analysis, sigma-authoring, lolbin-hunt
References
- Microsoft about_Logging_Windows: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logging_windows
- MITRE ATT&CK T1059.001: https://attack.mitre.org/techniques/T1059/001/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

