Partager via


ValidateQuery Method in Class SMS_CollectionRuleQuery

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

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: String

    Qualifiers: [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

For more information, see Configuration Manager Server Runtime Requirements.

Development Requirements

For more information, see Configuration Manager Server Development Requirements.

See Also

Concepts

SMS_CollectionRuleQuery Server WMI Class