Suspicious PowerShell.
Not Every Encoded Command Is An Attack.
An alert triage reference, not an incident lifecycle. This is what a SOC analyst actually does in the minutes after AMSI, an EDR sensor, or a script block logging rule flags PowerShell content: what to pull first, what separates a real intrusion from a noisy admin tool, and when to stop triaging and escalate. For the 4104/4103 script-block-logging events this alert is usually built on, see the Windows Event ID Cheatsheet.
Alert Overview
This alert rarely fires from a single sensor. Most PowerShell detections are one of four trigger sources, and knowing which one raised the alert changes what data is available to triage it with.
Common Trigger Sources
AMSI Or EDR Flag ├── Antimalware Scan Interface or an EDR sensor flags the PowerShell content itself, not just the process launch └── The flag usually fires on what the script does, not on the fact that PowerShell ran // the most common single trigger, and also the noisiest one Event ID 4104, Script Block Logging ├── A detection rule matches decoded script block content against a known-bad string or pattern └── This is the richest data source available for this alert. it shows the actual code, not just the command line // pull this first, everything else in triage builds on it Encoded Or Obfuscated Command Line ├── -EncodedCommand, a base64 blob, or string concatenation built to defeat keyword matching └── Obfuscation alone isn't malicious by itself. it just raises the bar for how closely triage has to look // presence of obfuscation is a reason to look closer, not a verdict on its own Unusual Parent Process ├── PowerShell spawning from winword.exe, excel.exe, outlook.exe, or a browser process └── A normal admin session spawns PowerShell from explorer.exe, a terminal, or an RMM agent, not an Office app // parent process is often the fastest signal for separating real from noise
Initial Triage Steps
Work through these in order. Each step narrows the picture before the next one, and skipping ahead usually means redoing work later.
Working The Alert, In Order
1. Pull the full command line and the decoded script block ├── Event ID 4104 (script block logging) gives the decoded content, not just what was typed at a prompt └── Event ID 4103 (module logging) shows which cmdlets and modules actually ran // the command line alone is often close to useless if the payload is encoded 2. Identify the parent process ├── A legitimate admin or RMM tool, an Office application, or something unrecognized entirely └── This one fact narrows the rest of the triage more than almost anything checked afterward // know what should have launched PowerShell before judging what did 3. Decode any base64 or -EncodedCommand content ├── Read what the payload actually does before forming an opinion on it └── An encoded string that decodes to a harmless one-liner ends the triage fast // don't triage off the encoded blob, decode it and read the result 4. Check for execution-policy-bypass flags together ├── -ExecutionPolicy Bypass, -NoProfile, -WindowStyle Hidden, -NonInteractive └── Any one alone shows up in legitimate scripting constantly. all four together is a rarer, more deliberate combination // look for the combination, not any single flag in isolation 5. Check for download-cradle patterns ├── IEX (New-Object Net.WebClient).DownloadString(...), or Invoke-WebRequest piped into Invoke-Expression └── This pattern fetches remote content and runs it without ever writing a file to disk // a confirmed cradle turns the rest of this triage into an active-compromise response
True Positive Indicators
Signals that point toward malicious use. None of these alone is automatic proof, but they carry real weight, especially in combination.
Encoded Command Plus Obfuscation
-EncodedCommand or -enc combined with excessive string concatenation, character-code building, or repeated encoding layers. A single encoding pass is common. stacked obfuscation on top of it is a deliberate attempt to defeat detection.In-Memory Download Cradle
AMSI Bypass Pattern
[Ref].Assembly-based tricks that flip the AMSI scan result in memory. There's no legitimate business reason to disable the interface that's supposed to be scanning the script itself.Office Or Script-Host Parent Process
Hidden Window, No Profile, Bypass Together
False Positive Indicators
Reasons the same flags show up on legitimate activity. Worth ruling out before treating every encoded command as an attack.
Known RMM Or Admin Tooling
-EncodedCommand to avoid quoting issues, not to evade detection. Confirm the source before treating the encoding itself as suspicious.Internal Automation Or DevOps Tooling
-NonInteractive, -NoProfile, and hidden windows for the same reason a real intrusion does: they need to run unattended, without a user session in the way.Security Tooling Triggering Its Own Rule
Escalation Criteria
The conditions under which triage stops and this becomes a live incident, not a decision to sit on while gathering more context.
Confirmed Download Cradle
Confirmed AMSI Bypass
Correlates With A Phishing Email To The Same User
Containment Actions
What to do once the alert is confirmed malicious, in an order that protects evidence before it protects convenience.