Skip to content
medium severityMicrosoft Defender XDR

Detect WMI process execution (KQL)

Windows Management Instrumentation (WMI) lets an attacker launch processes locally or on remote hosts without touching cmd or a service, which is why it is favoured for stealthy execution and lateral movement. This DeviceProcessEvents query catches both forms: processes whose parent is WmiPrvSE.exe (the WMI provider host) and direct wmic process call create command lines.

Filtering out the normal WMI housekeeping children keeps the results focused on actual command execution.

The query

DeviceProcessEvents
| where Timestamp > ago(7d)
| where (InitiatingProcessFileName =~ "WmiPrvSE.exe"
         and FileName !in~ ("WmiPrvSE.exe", "wmiadap.exe", "wmiapsrv.exe"))
    or (FileName =~ "wmic.exe"
         and ProcessCommandLine has "process"
         and ProcessCommandLine has "call"
         and ProcessCommandLine has "create")
| project Timestamp, DeviceName, AccountName,
          InitiatingProcessFileName, FileName,
          ProcessCommandLine, InitiatingProcessCommandLine
| sort by Timestamp desc

Line-by-line explanation

  • InitiatingProcessFileName =~ "WmiPrvSE.exe"

    WmiPrvSE.exe is the WMI provider host; anything it spawns was launched through WMI, including remote command execution.

  • FileName !in~ ("WmiPrvSE.exe", "wmiadap.exe", "wmiapsrv.exe")

    Removes the routine WMI service processes so only real payload children remain.

  • FileName =~ "wmic.exe" and ProcessCommandLine has "process" ... "create"

    Also catches the direct wmic process call create pattern used for local and remote execution.

Required tables and columns

  • InitiatingProcessFileNameParent image; WmiPrvSE.exe indicates WMI-launched execution.
  • FileNameThe spawned process, or wmic.exe for the direct invocation.
  • ProcessCommandLineThe command executed, including the wmic process call create syntax.
  • AccountNameThe account under which the process ran.

MITRE ATT&CK mapping

Tuning and false positives

  • Baseline management and inventory tools that use WMI heavily (SCCM, backup, monitoring) and exclude their known children.
  • Join with DeviceNetworkEvents to spot WMI execution that immediately makes an outbound connection.

Limitations

  • Remote WMI execution shows on the target as a WmiPrvSE child but does not reveal the source host here; pivot via DeviceLogonEvents for the network logon.
  • Event-subscription persistence via WMI is a different signal, not covered by this process-creation query.

References

Last reviewed 2026-11-18.