Lesson 141 — The Browser Spawned PowerShell
A user is browsing the web when Microsoft Defender XDR records something that deserves attention: the browser launches PowerShell.
That relationship is the clue. In this lesson, we will not treat powershell.exe as malicious simply because it exists. We will reconstruct the process chain, inspect the command line, identify the user and device, pivot into network activity and decide whether the evidence supports normal automation or the beginning of an endpoint compromise.

Your case file
A browser launches PowerShell on a finance workstation. Seconds later, PowerShell makes an outbound connection.
Case briefing
Investigation objective
Determine why a browser spawned PowerShell, what command executed, which user and device were involved, what happened immediately before and after execution, and whether the child process communicated externally.
Investigator's rule
A process name is not a verdict. PowerShell is a legitimate administrative tool. The investigation becomes meaningful when you examine who launched it, how it was launched, what it was told to do and what happened next.
Stage 1 — find browser-to-PowerShell relationships
Begin with DeviceProcessEvents. Instead of searching for every PowerShell execution, constrain the investigation to PowerShell processes whose initiating process is a browser.
let TargetDevice = "WS-FIN-042";
DeviceProcessEvents
| where Timestamp > ago(24h)
| where DeviceName =~ TargetDevice
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where InitiatingProcessFileName in~ ("msedge.exe", "chrome.exe", "firefox.exe")
| project Timestamp,
DeviceName,
AccountName,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
FileName,
ProcessCommandLine,
SHA1,
ProcessId,
InitiatingProcessId
| order by Timestamp ascWhy the parent matters
powershell.exe launched from an administrator's terminal can be expected. The same process launched directly by a browser deserves a different question. Parent-child relationships give process telemetry context.
Read the command line
Do not stop at FileName. Inspect ProcessCommandLine for URLs, encoded content, download functions, hidden-window options, execution-policy changes, unusual paths or commands that create another process.
Stage 2 — reconstruct the surrounding process timeline
Once you have the suspicious timestamp, widen the window. Ten minutes either side can reveal what the browser was doing before PowerShell appeared and what PowerShell launched afterwards.
let TargetDevice = "WS-FIN-042";
let TargetTime = datetime(2026-08-18 01:17:42);
DeviceProcessEvents
| where DeviceName =~ TargetDevice
| where Timestamp between (TargetTime - 10m .. TargetTime + 10m)
| project Timestamp,
FileName,
ProcessCommandLine,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
AccountName,
ProcessId,
InitiatingProcessId
| order by Timestamp ascDo not read events in isolation
A process tree is a story told through relationships. Look for browser → PowerShell → script host, command shell, archive utility or another executable. Also look backwards for the browser process and its command line.
Preserve identifiers
ProcessId and InitiatingProcessId help you follow execution relationships on the device. Keep timestamps as well: process IDs can be reused, so time and device context matter.
Stage 3 — interpret the PowerShell command
Imagine the process event contains a command similar to this:
Several features deserve investigation: hidden execution, a remote resource, iwr (Invoke-WebRequest) and content being passed to iex (Invoke-Expression). None should be judged from the keyword alone; together with an unexpected browser parent, they materially strengthen the suspicious chain.
Translate syntax into behaviour
The analyst's job is not merely to recognise suspicious strings. Explain the behaviour: the command attempts to retrieve remote content and execute it in memory while reducing user visibility.
Keep the evidence defensible
Record the original command line exactly as telemetry captured it. Your interpretation can change later; the underlying evidence should not.
Stage 4 — did PowerShell communicate externally?
Now pivot from process execution into DeviceNetworkEvents. Use the PowerShell process ID from the process evidence to look for network activity attributed to that process on the same device.
let TargetDevice = "WS-FIN-042";
let PowerShellPID = 6844;
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where DeviceName =~ TargetDevice
| where InitiatingProcessId == PowerShellPID
| project Timestamp,
DeviceName,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
RemoteUrl,
RemoteIP,
RemotePort,
Protocol,
ActionType
| order by Timestamp ascWhat strengthens the chain?
A network event seconds after execution, attributed to the same PowerShell process and matching infrastructure referenced by the command line, connects process evidence with network evidence.
What does it prove?
It can establish that the process made or attempted a connection recorded by Defender telemetry. It does not automatically prove that a payload executed successfully or that the destination itself was malicious.
Stage 5 — pivot from the destination across the estate
The remote destination now becomes the next investigative entity. Ask whether other devices have contacted the same infrastructure.
let SuspiciousUrl = "cdn-update.example";
DeviceNetworkEvents
| where Timestamp > ago(7d)
| where RemoteUrl has SuspiciousUrl
| summarize Connections=count(),
FirstSeen=min(Timestamp),
LastSeen=max(Timestamp),
Devices=make_set(DeviceName, 50),
Processes=make_set(InitiatingProcessFileName, 25)
by RemoteUrl, RemoteIP
| order by Connections descOne workstation may not be the whole incident
If several devices contact the same unusual destination through similar processes, the investigation may have moved from a single endpoint to an environment-wide hunt.
But prevalence needs context
A destination seen everywhere may belong to a legitimate CDN, software service or corporate application. Low prevalence can be interesting, but rarity is not proof of maliciousness.
Agent Foskett's endpoint timeline
Your evidence board
| Evidence | What it supports | Weight |
|---|---|---|
| Browser directly initiates PowerShell | Unusual parent-child relationship requiring explanation. | Supporting |
| PowerShell uses hidden execution | Reduced user visibility; suspicious in context. | Supporting |
| Command retrieves remote content | Establishes an attempt to obtain content from external infrastructure. | Strong |
| Retrieved content is passed to an execution function | Supports attempted remote-code/script execution. | Strong |
| Same PowerShell process produces network telemetry | Correlates execution and network behaviour. | Strong |
| Destination appears on other endpoints | May widen scope if process and timing context also align. | Supporting |
Write the finding like an investigator
Example: Microsoft Defender XDR process telemetry identified Microsoft Edge spawning PowerShell on WS-FIN-042 under the j.smith account. The PowerShell command line attempted to retrieve remote script content and pass it to an execution function while using a hidden window. Network telemetry recorded outbound activity attributed to the PowerShell process shortly afterwards. Taken together, the parent-child relationship, command behaviour and network correlation are consistent with suspicious browser-initiated PowerShell execution and warrant further investigation of subsequent file, process, persistence and lateral activity.
Lesson 141 key takeaways
- Do not classify PowerShell as malicious solely from its process name.
- Parent-child process relationships can provide the first important clue.
DeviceProcessEventslets you preserve process, command-line, account and initiating-process context.- Reconstruct activity around the suspicious timestamp instead of reading one event alone.
- Translate command-line syntax into observable behaviour.
- Use process identifiers together with device and time context when pivoting.
DeviceNetworkEventscan connect process execution to external communication.- A remote IP or URL can become the next investigative entity.
- Prevalence is context, not proof.
- Every conclusion should remain traceable to the underlying telemetry.
Module 12 begins — Advanced Endpoint Investigation
Lesson 141 establishes the first link in our endpoint attack chain. In the lessons ahead we will examine encoded PowerShell, abnormal process trees, files appearing before execution, process-to-network correlation, registry persistence, hash prevalence, movement between devices and finally a complete endpoint compromise timeline.
Continue your KQL investigation training
Related Agent Foskett Investigations
🔎 KQL Academy — Module 12: Advanced Endpoint Investigation
Investigate a browser spawning PowerShell with KQL
Lesson 141 of the Agent Foskett KQL Academy begins Module 12 with a Microsoft Defender XDR endpoint investigation using DeviceProcessEvents and DeviceNetworkEvents to follow a suspicious browser-to-PowerShell process chain.
Microsoft Defender XDR endpoint threat hunting
Learn how to correlate initiating processes, PowerShell command lines, process identifiers, users, devices and remote infrastructure so endpoint telemetry becomes a defensible investigation story rather than a collection of isolated events.
