🧬 WQL / PowerShell

Win32_Process: Filtering Processes (WQL WHERE)

Shows the WQL WHERE clause syntax against Win32_Process, starting from a LIKE '%' wildcard you customize with a real search term.

By WindowsScripting.com · 688 B
ProcessFiltered.ps1
<#
.SYNOPSIS
    WQL reference: filtering Processes with a WHERE clause (Win32_Process).

.DESCRIPTION
    WQL supports a SQL-like WHERE clause for narrowing results. This
    starts from a LIKE '%' wildcard (matches everything) against
    Name — replace the wildcard with a real substring to filter
    for, e.g. WHERE Name LIKE '%searchterm%'.

.EXAMPLE
    .\ProcessFiltered.ps1
#>

[CmdletBinding()]
param()

$wqlQuery = "SELECT Name, ProcessId, WorkingSetSize, ThreadCount FROM Win32_Process WHERE Name LIKE '%'"

Write-Host "WQL: $wqlQuery" -ForegroundColor DarkGray
Get-CimInstance -Query $wqlQuery | Format-Table -Property Name, ProcessId, WorkingSetSize, ThreadCount -AutoSize