// question

A malicious actor may attempt to list running processes on a Windows machine using a WMI-based command. Review the process creation events to find out which utility was invoked to perform this enumeration.

Reference KQL answer and model-by-model comparison.

640cbf6d-659b-498b-ba53-f6dd1a1cc02c
question id
10/23
models correct
1
valid answer
43%
success rate
// reference answer

Human-validated correct answer for this question.

wmic.exe
// model comparison
ModelAnswerKQL queryStatusTriesTimeCost
gemini-2.5-flash-preview-04-17
powershell.exe
DeviceProcessEvents
| where ActionType == "ProcessCreated"
| where ProcessCommandLine contains "wmic process list" or ProcessCommandLine contains "Get-Process" or ProcessCommandLine contains "Get-CimInstance" or ProcessCommandLine contains "Get-WmiObject"
| project TimeGenerated, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
fail110.70s0.0037
gpt-35-turbo
wmiprvse.exe
DeviceProcessEvents | where ActionType == 'ProcessCreated' | where FileName endswith '.exe' | summarize count() by InitiatingProcessFileName
fail13.99s0.0024
gpt-4-turbo-2024-04-09
driverquery
DeviceProcessEvents
| where (InitiatingProcessCommandLine has_any('wmic', 'Get-WmiObject', 'gwmi', 'select', 'from', 'Win32_Process') or InitiatingProcessFileName =~ 'powershell.exe')
| where InitiatingProcessCommandLine has 'list' or InitiatingProcessCommandLine contains 'Select *'
| project DeviceName, InitiatingProcessCommandLine, ProcessCreationTime
fail425.93s0.2298
gpt-4.1
powershell.exe
DeviceProcessEvents
| where (tolower(FileName) == "wmic.exe" and ProcessCommandLine has_all ("process", "list"))
  or (tolower(FileName) == "powershell.exe" and (ProcessCommandLine has "Get-WmiObject" or ProcessCommandLine has "Get-CimInstance") and ProcessCommandLine has "Win32_Process")
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine
fail14.86s0.0115
gpt-4.1-finetuned
no answer
no query generatedfail50.00s0.0333
gpt-4.1-mini
powershell.exe
DeviceProcessEvents
| where ProcessCommandLine contains "wmic" or ProcessCommandLine contains "powershell" or ProcessCommandLine contains "Get-WmiObject" or ProcessCommandLine contains "Invoke-WmiMethod" or FileName == "wmic.exe" or FileName == "powershell.exe"
| project DeviceName, InitiatingProcessFileName, FileName, ProcessCommandLine, ProcessCreationTime
| sort by ProcessCreationTime desc
| take 50
fail378.71s0.0073
gpt-4.1-nano
tasklist
DeviceProcessEvents
| where ProcessCommandLine contains "wmic process list" or ProcessCommandLine contains "powershell Get-Process" or ProcessCommandLine contains "tasklist"
| project TimeGenerated, DeviceName, InitiatingProcessFileName, ProcessCommandLine
fail35.06s0.0009
gpt-4o
no answer
no query generatedfail50.00s0.0540
gpt-5-high
PowerShell
DeviceProcessEvents
| where ActionType == "ProcessCreated"
| where isnotempty(ProcessCommandLine)
// lowercase helpers for case-insensitive matching
| extend fn = tolower(FileName)
| extend lcmd = tolower(ProcessCommandLine)
// WMIC patterns for process enumeration
| extend isWMIC = (fn == "wmic.exe" and (lcmd has " win32_process" or lcmd matches regex "\\bpath\\s+win32_process\\b" or lcmd matches regex "\\bprocess(\\s+list|\\s+where|\\s+get|\\s+call)\\b"))
| extend isWMICRemote = isWMIC and (lcmd has "/node:" or lcmd matches regex "\\b/node:\\s*\\S+")
// PowerShell WMI/CIM patterns for Win32_Process
| extend isPSCim = (fn in ("powershell.exe","pwsh.exe") and lcmd matches regex "\\b(get-ciminstance|gcim)\\b.*\\b(win32_process)\\b")
| extend isPSWmi = (fn in ("powershell.exe","pwsh.exe") and lcmd matches regex "\\b(get-wmiobject|gwmi)\\b.*\\b(win32_process)\\b")
| extend isPSRemote = (isPSCim or isPSWmi) and (lcmd has "-computername" or lcmd has "-cimsession" or lcmd matches regex "\\bnew-cimsession\\b")
// VBScript via WMI (best-effort based on CLI)
| extend isVBSWmi = (fn in ("cscript.exe","wscript.exe") and lcmd matches regex "\\b(winmgmts:|win32_process|root\\\\cimv2)\\b")
| where isWMIC or isPSCim or isPSWmi or isVBSWmi
| extend Utility = case(
    isWMICRemote, "WMIC (remote)",
    isWMIC, "WMIC",
    isPSRemote and isPSCim, "PowerShell Get-CimInstance (remote)",
    isPSCim, "PowerShell Get-CimInstance",
    isPSRemote and isPSWmi, "PowerShell Get-WmiObject/gwmi (remote)",
    isPSWmi, "PowerShell Get-WmiObject/gwmi",
    isVBSWmi, "VBScript via WMI",
    "Other"
)
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine, Utility,
          InitiatingProcessParentFileName, InitiatingProcessParentId
| summarize Count = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
            SampleCommand = take_any(ProcessCommandLine)
          by Utility, DeviceName, AccountName
| order by LastSeen desc, Count desc
fail2213.61s0.1069
gpt-5-mini-high
wmic
DeviceProcessEvents
| where isnotempty(ProcessCommandLine) or isnotempty(InitiatingProcessCommandLine)
| where ProcessCommandLine has_cs "wmic" or ProcessCommandLine has_cs "Get-WmiObject" or ProcessCommandLine has_cs "Get-CimInstance" or ProcessCommandLine has_cs "Win32_Process" or ProcessCommandLine has_cs "Invoke-WmiMethod" or InitiatingProcessCommandLine has_cs "wmic" or InitiatingProcessCommandLine has_cs "Get-WmiObject" or InitiatingProcessCommandLine has_cs "Get-CimInstance" or InitiatingProcessCommandLine has_cs "Win32_Process" or InitiatingProcessCommandLine has_cs "Invoke-WmiMethod"
| extend Who = coalesce(AccountName, InitiatingProcessAccountName)
| project TimeGenerated, DeviceName, FileName, ProcessId, ProcessCreationTime, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessId, Who
| order by TimeGenerated desc
| take 500
pass1617.24s0.0040
gpt-5-mini-low
wmic.exe
// Detect WMI-based process enumeration via command-line indicators
let wmi_regex = @"\b(wmic|wmic.exe|get-wmiobject|get-ciminstance|get-ciminstance|gwmi|invoke-wmimethod)\b";
union isfuzzy=true
(
  DeviceProcessEvents
  | where isnotempty(ProcessCommandLine) or isnotempty(InitiatingProcessCommandLine)
  | extend cmd = coalesce(ProcessCommandLine, InitiatingProcessCommandLine)
  | extend sourceTable = "DeviceProcessEvents"
),
(
  DeviceEvents
  | where ActionType has "Process" or ActionType has "Create" or ActionType has "ProcessCreated"
  | where isnotempty(ProcessCommandLine) or isnotempty(InitiatingProcessCommandLine)
  | extend cmd = coalesce(ProcessCommandLine, InitiatingProcessCommandLine)
  | extend sourceTable = "DeviceEvents"
)
| extend cmd_l = tolower(cmd)
| where cmd_l matches regex wmi_regex
      or cmd_l contains "win32_process"
      or cmd_l contains "select * from"
      or cmd_l contains "/node:"
      or cmd_l contains "/namespace:"
      or cmd_l contains "-class win32_process"
      or cmd_l contains "-query"
      or cmd_l contains "process list"
| project TimeGenerated,
          ProcessCreationTime = coalesce(ProcessCreationTime, InitiatingProcessCreationTime, TimeGenerated),
          DeviceName,
          FileName,
          ProcessId,
          InitiatingProcessId,
          AccountName,
          InitiatingProcessAccountName,
          cmd,
          sourceTable,
          ReportId
| sort by ProcessCreationTime desc
| take 500
pass341.27s0.0121
gpt-5-mini-medium
wmic.exe
DeviceProcessEvents
| where (
    tolower(coalesce(ProcessCommandLine, "")) has "wmic"
    or tolower(coalesce(ProcessCommandLine, "")) has "get-wmiobject"
    or tolower(coalesce(ProcessCommandLine, "")) has "gwmi"
    or tolower(coalesce(ProcessCommandLine, "")) has "get-ciminstance"
    or tolower(coalesce(ProcessCommandLine, "")) has "invoke-wmimethod"
    or tolower(coalesce(ProcessCommandLine, "")) has "win32_process"
    or tolower(coalesce(FileName, "")) has "wmic"
)
| extend DetectedUtility = case(
    tolower(coalesce(FileName, "")) has "wmic" or tolower(coalesce(ProcessCommandLine, "")) has "wmic", "wmic.exe",
    tolower(ProcessCommandLine) has "get-wmiobject" or tolower(ProcessCommandLine) has "gwmi" or tolower(ProcessCommandLine) has "invoke-wmimethod" or tolower(ProcessCommandLine) has "win32_process", "powershell (Get-WmiObject/gwmi)",
    tolower(ProcessCommandLine) has "get-ciminstance" or tolower(ProcessCommandLine) has "ciminstance", "powershell (Get-CimInstance)",
    "unknown"
)
| project Timestamp, DeviceName, AccountName, FileName, ProcessId, ProcessCreationTime, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName, DetectedUtility, ReportId
| order by ProcessCreationTime desc
| take 100
pass128.57s0.0068
gpt-5-nano-high
no answer
no query generatedfail50.00s0.0067
gpt-5-nano-medium
no answer
no query generatedfail50.00s0.0080
grok-3-beta
wmic
DeviceProcessEvents
| where ProcessCommandLine has 'wmic' and ProcessCommandLine has 'process' and (ProcessCommandLine has 'list' or ProcessCommandLine has 'get')
| project Timestamp, DeviceName, InitiatingProcessFileName, ProcessCommandLine, InitiatingProcessAccountName
| summarize Count=count() by InitiatingProcessFileName, ProcessCommandLine, DeviceName, InitiatingProcessAccountName, Timestamp
| order by Timestamp desc
| take 100
pass321.83s0.0567
grok-3-mini-beta
wmic
DeviceProcessEvents
| where ProcessCommandLine has 'wmic process' or ProcessCommandLine has 'Get-WmiObject Win32_Process'
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine
| order by TimeGenerated desc
pass113.42s0.0015
o1-high
wmic
DeviceProcessEvents
| where ActionType in~ ("CreateProcess", "ProcessCreated")
| where isnotempty(ProcessCommandLine)
| where tolower(ProcessCommandLine) has_any ("wmic", "get-wmiobject", "get-ciminstance", "win32_process", "gwmi")
| project TimeGenerated, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc
pass2104.13s0.3759
o1-low
wmic
DeviceProcessEvents
| where ActionType == "ProcessCreated"
| where FileName =~ "wmic.exe" or ProcessCommandLine has_any ("wmic process", "Get-WmiObject", "Get-CimInstance", "win32_process")
| project TimeGenerated, DeviceName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc
pass124.17s0.1832
o3-high
powershell.exe
DeviceProcessEvents
// Time range will be injected by the calling function
| where ActionType == "ProcessCreated"
// ---- Hunt for WMI-based process enumeration ---------------------------------
| where (
        // Native WMIC utility explicitly targeting processes
        (tolower(FileName) == "wmic.exe" and ProcessCommandLine has "process")
        // Generic command-lines that contain both "wmic" and "process"
        or (ProcessCommandLine has "wmic" and ProcessCommandLine has "process")
        // PowerShell WMI/CIM cmdlets interrogating Win32_Process
        or (tolower(FileName) in ("powershell.exe", "pwsh.exe")
            and ProcessCommandLine has_any ("Get-WmiObject", "gwmi", "Get-CimInstance")
            and ProcessCommandLine has "Win32_Process")
        // Impacket / other WMIC wrappers
        or (tolower(FileName) == "wmiexec.exe")
)
// -----------------------------------------------------------------------------
| extend Utility = tolower(FileName)
| summarize Executions = count(),
            Devices    = dcount(DeviceId),
            FirstSeen  = min(TimeGenerated),
            LastSeen   = max(TimeGenerated),
            SampleCmds = make_list(ProcessCommandLine, 5)
            by Utility
| order by Executions desc
fail171.11s0.0290
o3-mini-high
wmic
DeviceProcessEvents
| where isnotempty(ProcessCommandLine) and (ProcessCommandLine contains "wmic" or InitiatingProcessCommandLine contains "wmic")
| project TimeGenerated, DeviceName, AccountName, ProcessId, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc
pass120.69s0.0126
o3-mini-low
wmic
DeviceProcessEvents
| where ProcessCommandLine has "wmic" and ProcessCommandLine has "process"
| project TimeGenerated, DeviceName, FileName, ProcessCommandLine, InitiatingProcessCommandLine
| order by TimeGenerated desc
pass19.69s0.0098
o4-mini-high
wmic
DeviceProcessEvents
| where ActionType == "ProcessCreated"
    and (
        ProcessCommandLine has_cs "wmic"
        or ProcessCommandLine has_cs "Get-WmiObject"
        or ProcessCommandLine has_cs "gwmi"
    )
| project TimeGenerated,
          DeviceName,
          AccountName = InitiatingProcessAccountName,
          ParentProcess = InitiatingProcessFileName,
          ParentCommandLine = InitiatingProcessCommandLine,
          ProcessFileName = FileName,
          ProcessCommandLine
| order by TimeGenerated desc
pass135.95s0.0144
o4-mini-low
no answer
no query generatedfail50.00s0.0399