The ValidateQuery Windows Management Instrumentation (WMI) class method, in Configuration Manager, verifies that the query collection rule is a valid WQL or Extended WQL statement.

The following syntax is simplified from Managed Object Format (MOF) code and is intended to show the definition of the method.

Boolean ValidateQuery(
	 String WQLQuery
)

Parameters

WQLQuery


Data type: StringQualifiers: [in]Query statement to validate.

Return Values

A Boolean data type that is true if the query is validated.

Remarks

Your application calls this method before adding a query rule to a collection. An invalid query rule results in no members being added to the collection for that query. This can be misleading and hard to debug.

In addition to being syntactically correct, the query rule must specify resource class names in the FROM clause. For example, the FROM clause must specify SMS_R_System Server WMI Class, SMS_R_User Server WMI Class, SMS_R_UserGroup Server WMI Class, or a user-defined resource class name.

Example Code

For an example that uses the ValidateQuery method, see How to Create a Subcollection.

Requirements

Runtime Requirements

Development Requirements

See Also


Send comments about this topic to Microsoft.