Black Friday & Cyber Monday

10% off everything with code WITC10 — no minimum 20% off orders over $40 with code WITC20

One code per order — the two codes cannot be combined.

Shop the sale

Blog

How to Investigate Suspicious PowerShell Activity on Windows

Learn to investigate suspicious PowerShell activity on Windows with the key event IDs, a triage workflow, and clear escalation criteria.


Last Updated: November 17, 2026

Quick Summary

Suspicious PowerShell activity is a script or command run in a way that doesn’t match normal work on that machine, such as encoded commands, internet downloads or execution policy bypasses. To investigate it, confirm Script Block Logging is enabled, review Event IDs 4103 and 4104 in the PowerShell Operational log, and decode any hidden strings.

  • Enable Script Block Logging, Module Logging and Transcription before an incident, because the evidence must already be recorded.
  • Read Event ID 4104 for script text and Event ID 4103 for executed commands, matching them by timestamp.
  • Decode any Base64 string in a 4104 event to reveal the real script content.
  • Corroborate PowerShell events with process creation (4688), network and WMI telemetry before concluding an attack.
  • Contain by isolating the network connection rather than shutting down, and preserve logs before reimaging.

Table of Contents

What Suspicious PowerShell Activity Looks Like

PowerShell is a built-in Windows tool that administrators use every day, which is exactly why attackers use it too. Suspicious PowerShell activity is any script or command run in a way that does not match normal work on that machine. Most of the signs are context, not a single bad command.

Watch for these patterns:

  • Encoded commands, where the script is hidden in a long Base64 string passed with -EncodedCommand
  • Downloads from the internet using Invoke-WebRequest, DownloadString, or Net.WebClient
  • Execution policy bypasses, such as -ExecutionPolicy Bypass on a machine where no admin would do that
  • Scripts launched by Office applications, browsers, or PDF readers, not by a user at a console
  • PowerShell started from unusual parent processes, such as a document viewer or a scheduled task nobody created

Any one of these can be legitimate. Together, on a machine with no admin work scheduled, they deserve a closer look. A common mistake is to treat a single encoded command as proof of an attack. Context decides the answer.

Why Manual Investigation Is Hard for Small and Mid-Sized Businesses

Investigating PowerShell activity takes time, specific logs, and someone who knows what normal looks like. Most small and mid-sized businesses have none of these in surplus.

The main problems are:

  • Logs are off by default. Script Block Logging and Transcription must be turned on before an incident. If they were not, the evidence you need does not exist.
  • Volume is high. A busy machine generates thousands of PowerShell events a day, and most are routine.
  • Few people have the skills. The person who handles IT often also handles email, printers, and new hires.
  • Time is short during an incident. Staff want systems back up quickly, which pushes careful evidence collection aside.

These limits do not mean a small business cannot investigate. They mean the work should be planned, and the plan should include when to bring in outside help.

Step 1: Confirm Logging Is Enabled Before You Need It

You cannot investigate what you did not record. Check logging settings now, not during an incident.

Open the Local Group Policy Editor (gpedit.msc) or your domain’s Group Policy and go to:

Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell

Enable these settings:

  • Turn on PowerShell Script Block Logging
  • Turn on Module Logging
  • Turn on PowerShell Transcription, with a secure output folder

Also confirm that the Windows PowerShell and Microsoft-Windows-PowerShell/Operational event logs are large enough to hold several days of activity. Small default sizes overwrite evidence quickly.

Watch out: Transcription files can contain sensitive data, such as passwords typed into scripts. Restrict who can read the output folder.

Step 2: Pull PowerShell Script Block Logging Event ID Records

Once logging is on, the key records are in the Microsoft-Windows-PowerShell/Operational log. You can open it in Event Viewer under Applications and Services Logs > Microsoft > Windows > PowerShell > Operational.

IT administrator reviewing Windows Event Viewer logs to identify suspicious PowerShell activity at a desk.
IT administrator reviewing Windows Event Viewer logs to identify suspicious PowerShell activity at a desk.

The event IDs that matter most are:

Event ID What It Records Why It Matters
4103 Module logging: pipeline execution details Shows which modules and commands ran
4104 Script Block Logging: the actual script text Shows what the code was, even if it was encoded
4105 and 4106 Start and stop of script blocks Helps place events in time
400 and 403 Engine start and stop Shows when a PowerShell session began and ended

To filter quickly, use Event Viewer’s Filter Current Log option and enter 4103, 4104 in the Event IDs field. Narrow the time range to the window you care about.

Step 3: Interpret Event ID 4103 and 4104 Together

Neither event tells the full story alone. Read them side by side, then corroborate with process, network, and WMI telemetry so a single decoded string is not mistaken for proof of compromise.

Event 4104 shows the script text, often after de-obfuscation. Event 4103 shows the commands and parameters that ran in the pipeline. Match them by timestamp and by the process ID where available. A practical habit is to decode any Base64 string in a 4104 event and read the result in plain text, many suspicious scripts become obvious once decoded.

Look for these combinations in 4103/4104 pairs:

  • A download command in 4104 followed by a file write or execution in 4103
  • Encoded text in 4104 that decodes to a web address or a command that disables security tools
  • Repeated short sessions at odd hours, which can indicate automation
  • -ExecutionPolicy Bypass, -WindowStyle Hidden, -NoProfile, or -NonInteractive flags that rarely appear in normal admin work

Corroborate with process creation (Event ID 4688)

PowerShell events tell you what code ran; process creation tells you who launched it and from where. Enable Audit Process Creation under Computer Configuration > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Detailed Tracking, and turn on Include command line in process creation events under Administrative Templates > System > Audit Process Creation. Then review Security log Event ID 4688 for powershell.exe and pwsh.exe.

The most useful fields are the parent process name, the full command line, the user account, and the integrity level. A powershell.exe whose parent is winword.exe, excel.exe, outlook.exe, or a browser is a classic malicious pattern; the same binary launched by explorer.exe or a known management agent is usually routine.

Corroborate with network telemetry

PowerShell download cradles (Invoke-WebRequest, DownloadString, Net.WebClient, Start-BitsTransfer) leave traces in a few places. Check Security log 5156 (Windows Filtering Platform connection allowed) if audit filtering is enabled, Sysmon Event ID 3 (network connection) if Sysmon is deployed, and DNS Client events in Microsoft-Windows-DNS-Client/Operational for lookups that match the decoded URL. A 4104 download command with no matching outbound connection is still worth investigating, but the absence changes the urgency.

Corroborate with WMI activity

Attackers use WMI for discovery and persistence (Get-WmiObject, Invoke-CimMethod, Win32_Process.Create). Review Applications and Services Logs > Microsoft > Windows > WMI-Activity > Operational for Event ID 5857 (provider started), 5860 (temporary event consumer registered), and 5861 (permanent event consumer registered). A 5861 event paired with a PowerShell 4104 that references __EventFilter or CommandLineEventConsumer is a strong persistence indicator.

Corroborate with module and transcription logs

Event 4103 shows which modules loaded. A session that loads Net.WebClient and System.Reflection but never touches Microsoft.PowerShell.Management looks more like a loader than an admin script. If transcription is enabled, the timestamped text files in the output folder give you the full session transcript, including output that never appears in the event log.

Watch out: 4104 records are truncated at roughly 1 KB by default. Long scripts appear as multiple fragments with the same ScriptBlock ID, so search by that ID rather than by a single line, or you will miss the payload.

Step 4: Separate Benign Administration From Malicious Behavior

This step matters most, because false alarms waste time and real threats can hide among routine work.

Ask these questions for each suspicious event:

  1. Is there a known task? Check scheduled tasks, deployment tools, and patch management for a matching job.
  2. Who ran it? A logged-in administrator running a maintenance script differs from an unknown account at 3 a.m.
  3. Where did it come from? Internal management servers and vendor tools have predictable names and paths.
  4. Does it touch sensitive areas? Changes to security settings, new services, or added accounts deserve more attention than reading a folder.

Benign administration usually has an owner, a schedule, and a clear purpose. Malicious behavior usually has none of these and tries to hide its purpose, often through encoding or by disabling logging itself.

A useful check: if you cannot name who or what should have run the command, treat it as unexplained until you can.

Step 5: Contain, Preserve Evidence, and Recover

If you confirm malicious activity, act in this order. The sequence matters more than any single tool, because the wrong first move destroys evidence you cannot recreate.

Contain without destroying evidence

Disconnect the affected machine from the network, but leave it powered on so memory and volatile logs stay intact. On a laptop, disable Wi-Fi and unplug Ethernet; on a desktop, unplug the cable or disable the adapter from another admin session. Do not shut down, and do not run a full antivirus scan yet, both overwrite memory and can trigger attacker cleanup logic.

At the network edge, block the domains and IP addresses you extracted from decoded 4104 events and from DNS or Sysmon network events. If you have a firewall or DNS filter, add the indicators there rather than on the host, so the block survives a reboot.

Watch out: pulling the power or forcing a shutdown to “stop the attack” is the most common evidence-destroying mistake in small-business incidents. Contain by isolation, not by power loss.

Preserve volatile and on-disk evidence

Capture memory before anything else if the host may hold credentials or injected code. Built-in options include Task Manager’s Create dump file on powershell.exe and other suspicious processes, or a full memory image with a trusted forensic tool your team has validated. Record the SHA-256 hash of every file you collect and the exact time of collection.

Copy these artifacts to a separate drive or share that the affected host cannot write to:

  • The Microsoft-Windows-PowerShell/Operational log (export as .evtx from Event Viewer)
  • The Security log, for 4688 process creation and 5156 network events
  • The WMI-Activity/Operational log
  • The transcription output folder, if enabled
  • Any script files referenced in 4104 events, plus $env:APPDATA, $env:TEMP, and C:\ProgramData contents modified in the incident window
  • Scheduled tasks (schtasks /query /fo LIST /v), services (sc query), and autoruns entries

Keep a written timeline: who did what, at what time, on which host. Do not rely on the original machine to keep its logs, attackers frequently clear the PowerShell and Security logs, and Event ID 1102 in the Security log records a log clear.

Find the scope

Search the same event IDs, ScriptBlock IDs, decoded strings, and file hashes across other computers. Attackers usually reuse the same script or command across several machines, so a single indicator often reveals the full footprint. If you have centralized log collection, query it; if not, export the same logs from each suspect host and compare.

Remove persistence before recovery

Reimaging is the safest recovery for a confirmed compromise, but persistence can survive a reimage if it lives in domain accounts, Group Policy, or cloud services. Before you rebuild, check for:

  • New or modified scheduled tasks and services
  • WMI permanent event consumers (Event ID 5861)
  • New local accounts and changes to privileged groups
  • Startup folder and Run key entries
  • Malicious Group Policy objects or logon scripts in Active Directory
  • Newly registered applications or OAuth consents in Microsoft 365, if the host had cloud credentials

Recover and validate

Reimage the affected machine rather than trying to clean it by hand. Reset any credentials that appeared in scripts or memory, revoke active sessions, and review accounts the attacker may have created. After the host is back, confirm that logging is still enabled, attackers sometimes disable Script Block Logging via policy, and that the rebuilt host reports the expected event IDs. Validate recovery by watching for a few days of clean 4104 and 4688 activity from the rebuilt host before returning it to normal use.

A short written after-action note, what was found, what was contained, what was rebuilt, what was changed, turns a one-off incident into a repeatable process and gives you the evidence trail a managed provider or insurer will ask for.

Manual PowerShell Auditing vs. Managed EDR/MDR

Manual auditing works, but it has limits. The table below compares it with a managed approach.

Factor Manual PowerShell Auditing Managed EDR/MDR
Setup Group Policy and log tuning on each machine Agent deployed and managed centrally
Monitoring Only when someone checks the logs Continuous, including outside business hours
Alert triage Done by hand, slow with high volume Filtered and prioritized by the service
Investigation skill needed Strong in-house PowerShell knowledge Shared with the provider’s analysts
Response speed Depends on who is available Defined response workflows
Best for Small environments with a capable admin Businesses without a full security team

Manual work remains valuable for understanding your own environment. Many businesses combine the two: they keep logging configured in-house and let a managed service watch for patterns around the clock.

BullZIGA Managed EDR is designed for this combination. It automates threat detection across endpoints, correlates PowerShell behavior with other signals, and reduces the number of raw events a small team has to read. You still decide how to respond, but you start from a shortlist of likely threats instead of thousands of log lines.

Getting Help With PowerShell Threat Investigation

Bring in outside help when any of these apply:

  • You find evidence of data theft, ransomware, or an account takeover
  • Logs are missing or were cleared, which can mean the attacker covered their tracks
  • You do not have anyone who can read decoded PowerShell with confidence
  • The incident is spreading across several machines

When you choose a provider, ask whether they can read PowerShell logs and event IDs, how fast they respond, what evidence they will preserve, and whether they will help with recovery, not just detection.

For small and mid-sized businesses, a managed endpoint service often costs less than one serious incident. Shop.WorldITCenter.com offers BullZIGA Endpoint Security for Windows devices, with real-time monitoring, malware and ransomware detection, and centralized management, and can help you decide whether a managed EDR approach fits your environment. Start by confirming your logging today, then decide how much of the watching you want to keep in-house.

Frequently Asked Questions

What is suspicious PowerShell activity?

Suspicious PowerShell activity is PowerShell use that does not match normal administration. Common signs include encoded or obfuscated commands, scripts launched by unexpected parent processes such as Office applications or browsers, downloads from unknown locations, attempts to disable logging or security tools, and execution at unusual hours on systems where no administrator was working. A single signal is rarely conclusive, so investigators look for combinations of these patterns and confirm them against what the user or administrator actually did.

What do PowerShell Event IDs 4103 and 4104 mean?

Event ID 4104 is recorded by Script Block Logging and captures the content of PowerShell script blocks as they execute, including decoded content when commands were obfuscated. Event ID 4103 is recorded by Module Logging and shows pipeline execution details for loaded modules. Reviewing both together helps you see what was run and how it was invoked. Confirm that logging is enabled first, because these events are not generated by default on every Windows configuration.

How do I enable PowerShell Script Block Logging?

Script Block Logging is configured through Group Policy under Administrative Templates, Windows Components, Windows PowerShell, by enabling the setting Turn on PowerShell Script Block Logging. For standalone systems, the same setting can be applied through the local policy editor or the equivalent registry value. Apply the change, test it by running a harmless command, and confirm that Event ID 4104 appears in the Microsoft-Windows-PowerShell/Operational log. Enable logging before an incident, since events that were never recorded cannot be recovered later.

What should I do if I find suspicious PowerShell activity?

Do not immediately delete scripts or restart the machine, because that can destroy evidence. Preserve the relevant event logs, note the user account, host, and timestamps, and identify the parent process that launched PowerShell. Isolate the device from the network if you suspect active compromise, then review what the script downloaded or changed. If you cannot confirm whether the activity is benign or malicious within your available time and expertise, escalate to a security specialist or managed detection provider.