February 2019
Intermediate to advanced
626 pages
15h 51m
English
When building a WQL query, string values must be quoted; numeric and Boolean values do not need quotes.
As the filter is also a string, this often means nesting quotes within one another. The following techniques may be used to avoid needing to use PowerShell's escape character.
For filters or queries containing fixed string values, use either of the following styles. Use single quotes outside and double quotes inside:
Get-CimInstance Win32_Process -Filter 'Name="powershell.exe"'
Alternatively, use double quotes outside and single quotes inside:
Get-CimInstance Win32_Process -Filter "Name='powershell.exe'"
For filters or queries containing PowerShell variables or sub-expressions, use double quotes outside, as variables within ...
Read now
Unlock full access