The SMS_Query Windows Management Instrumentation (WMI) class is an SMS Provider server class, in System Center 2012 R2 Configuration Manager, that serves as a container for predefined queries.

The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.

Class SMS_Query : SMS_BaseClass
{
   String Comments;
   String Expression;
   String LimitToCollectionID;
   String LocalizedCategoryInstanceNames[];
   String Name;
   String QueryID;
   String ResultAliasNames[];
   String ResultColumnsNames[];
   String TargetClassName;
};

Methods

The following table lists the methods in SMS_Query.

Method Description

CreateCCRs Method in Class SMS_Query

Generates client configuration requests (CCRs) for the query.

FindResourceSite Method in Class SMS_Query

Gets site code information for resources from SQL.

Properties

Comments

Data type: StringAccess type: Read/WriteQualifiers: NoneComments to document the query. The default value is "".
Expression

Data type: StringAccess type: Read/WriteQualifiers: NoneWMI Query Language (WQL) text for the query. The default value is "".
LimitToCollectionID

Data type: StringAccess type: Read/WriteQualifiers: NoneID of a collection. This ID is used to limit the query results to resources that are members of the collection.
LocalizedCategoryInstanceNames

Data type: String ArrayAccess type: ReadQualifiers: NoneLocalized names of the categories to which the resource belongs.
Name

Data type: StringAccess type: Read/WriteQualifiers: NoneName of the query as shown in the Configuration Manager console. The default value is "".
QueryID

Data type: StringAccess type: Read-onlyQualifiers: [read, key]Unique auto-generated ID for the query.
ResultAliasNames

Data type: String ArrayAccess type: Read-onlyQualifiers: NoneIf you specify an alias in the query expression, this array will be filled with the aliases.
ResultColumnsNames

Data type: String ArrayAccess type: Read-onlyQualifiers: NoneIf you specify an alias in the query expression, this array will be filled with the resulting alias columns names.
TargetClassName

Data type: StringAccess type: Read/WriteQualifiers: NoneName of the target class, found in the FROM clause of the query. The default value is "".This name is arbitrary for queries that perform a JOIN operation. The Configuration Manager console uses this property for display purposes to give the user an idea of the data that the query retrieves.

Remarks

Class qualifiers for this class include:

  • Secured

  • DisplayName("Query")

For more information about both the class qualifiers and the property qualifiers included in the Properties section, see Configuration Manager Class and Property Qualifiers.

You can use SMS_Query to persist valid queries that can be used later in an application or that can be run from the System Center 2012 R2 Configuration Manager console.

Instances of this class with the TargetClassName property set to an SMS_StatusMessage Server WMI Class object appear in the System Status node in the System Center 2012 R2 Configuration Manager console. All other instances appear in the Queries node.

Requirements

Runtime Requirements

Development Requirements

See Also