← Back to SOC feed Coverage →

PowerShell adding exclusion path for Microsoft Defender of ProgramData

kql MEDIUM Azure-Sentinel
DeviceProcessEvents
huntingmicrosoftofficialpowershell
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-25T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may use PowerShell to create an exclusion path in the ProgramData directory to evade Microsoft Defender monitoring. SOC teams should proactively hunt for this behavior as it indicates potential evasion tactics aimed at hiding malicious activity from detection.

KQL Query

DeviceProcessEvents 
| where FileName =~ "powershell.exe" and ProcessCommandLine has_all("try", "Add-MpPreference", "-ExclusionPath", "ProgramData", "catch")

Analytic Rule Definition

id: bd6e909c-dfb1-4f8f-a94a-14d417bbe87b
name: PowerShell adding exclusion path for Microsoft Defender of ProgramData
description: |
  Identify PowerShell creating an exclusion path of ProgramData directory for Microsoft Defender to not monitor.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceProcessEvents
tactics:
- Defense Evasion
query: |   
  DeviceProcessEvents 
  | where FileName =~ "powershell.exe" and ProcessCommandLine has_all("try", "Add-MpPreference", "-ExclusionPath", "ProgramData", "catch")

Required Data Sources

Sentinel TableNotes
DeviceProcessEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Ransomware/DEV-0270/PowerShell adding exclusion path for Microsoft Defender of ProgramData.yaml