Queries are used to find a group of computers based on a set of criteria.
Queries can be built using the dropdown menus in the SCCM Administrative Console or by directly editing the raw WQL code. The easiest mode is to create a query via the dropdown menus. You may come across raw SQL queries while searching the web and you can paste the SQL into the WQL (SQL for WMI) box.
- In the SCCM Administrative Console go to Monitoring and click Queries.
- Right-click Queries and and select Create Query.
- Give you query a name, choose to a collection to limit your query, and then click Edit Query Statement...
- Click the Criteria tab and then click the yellow star which will open up the Criterion Properties window.
- Click the Select... button.
- You need to choose an Attribute class and Attribute.
- Select an Operator. Then choose a value by clicking the Value... button and select a value from the list. If you already know the value, you can manually enter it. Click the OK button and now you'll see your query with a criterion added.
You need to add an attribute to display for your query. Typically this is the computer name. Click the General Tab and then click the yellow starburst. Select the Attribute class - System Resource and the Attribute - NetBIOS Name.
- You may also want to add other columns, such as the software name you are querying, the version, etc. Click OK and choose to sort Ascending.
- Click OK twice and you'll be back at the Create Query Wizard. Click Next> and you'll see a summary showing the WQL code. Click Next> and then Close.
- Run your query by double-clicking the query from the query list. You'll a see a list of computers that fit the criteria that you specified.