Skip to main content

Overview

Execute a given WQL (WMI Query Language) query on the local system. This command provides direct access to WMI data through custom queries, offering maximum flexibility for data extraction and analysis.
ACLs are applied at the object class and instance level, so query results may vary depending on your privileges.

Syntax

Parameters

query
string
required
The WQL query to execute (must be properly quoted)
wmi-namespace
string
The WMI namespace to query (default: “root\CCM”)

Examples

WQL Syntax Reference

  • Use * to select all properties
  • Specify individual properties separated by commas
  • Use WHERE clause for filtering
  • LIKE - Pattern matching with wildcards (% and _)
  • IS NULL / IS NOT NULL - Check for null values
  • AND / OR - Combine conditions
  • IN - Match against a list of values

Common SCCM WQL Queries

Output Format

Query results are displayed in a structured format:

Use Cases

Create targeted queries to extract specific information not available through other SharpSCCM commands.
Combine multiple properties and conditions to build comprehensive intelligence about the SCCM environment.
Query specific WMI classes to diagnose client issues or understand configuration details.

Error Handling

Common query errors include:
  • Invalid class names - Verify the class exists using local classes
  • Permission denied - Some classes require elevated privileges
  • Syntax errors - Ensure proper WQL syntax and quoting