Database queries

Queries are customized searches for managed devices. LANDesk Management Suite provides a method for you to query devices that have been scanned into your core database via database queries, as well as a method for you to query for devices located in other directories via LDAP queries. You view, create and organize database queries with the Queries groups in the console's network view. You create LDAP queries with the Directory Manager tool.

For more information on creating and using LDAP directory queries with Directory Manager, see LDAP queries.

Read this chapter to learn about:

Queries overview

Queries help you manage your network by allowing you to search for and organize network devices that are in the core database, based on specific system or user criteria.

For example, you can create and run a query that captures only devices with a processor clock speed of less than 2 GHz, or with less than 1024 MB of RAM, or a hard drive of less than 20 GB. Create one or more query statements that represent those conditions and relate statements to each other using standard logical operators. When the queries are run, you can print the results of the query, and access and manage the matching devices.

Query groups

Queries can be organized into groups in the network view. Create new queries (and new query groups) by right-clicking the My queries group and selecting New query or New group, respectively.

A Management Suite administrator (user with Management Suite Administrator rights) can view the contents of all of the query groups, including My queries, Public queries, and All queries.

When other Management Suite users log in to the console, they can see queries in the My queries, Public queries, and All queries groups, based on their device scope.

When you move a query to a group (by right-clicking and selecting Add to new group or Add to existing group), or by dragging and dropping the query, you're actually creating a copy of the query. You can remove the copy in any query group and the master copy of the query (in the All queries group) isn't affected. If you want to delete the master copy, you can do it from the All queries group.

For more information on how query groups and queries display in the network view, and what you can do with them, see Understanding the network view.

Creating database queries

Use the New query dialog to build a query by selecting from attributes, relational operators, and the attribute's values. Build a query statement by choosing an inventory attribute and relating it to an acceptable value. Logically relate the query statements to each other to ensure they're evaluated as a group before relating them to other statements or groups.

To create a database query
  1. In the console's network view, right-click the My queries group (or Public queries, if you have the public query management right), and then click New query.
  2. Enter a unique name for the query.
  3. Select a component from the inventory attributes list.
  4. Select a relational operator.
  5. Select a value from the values list. You can edit a value.
  6. Click Insert to add the statement to the query list.
  7. If you want to query for more than one component, click a logical operator (AND, OR) and repeat steps 2-5.
  8. (Optional) To group query statements so they're evaluated as a group, select two or more query statements and click Group() .
  9. When you're finished adding statements, click Save.

About the New query dialog box

Use this dialog box to create a new query with the following functions:

The Like operator is a new relational operator. If a user doesn't specify any wild cards (*) in their query, the Like operator adds wildcards to both ends of the string. Here are three examples of using the Like operator:

Computer.Display Name LIKE "Bob's Machine" queries for: Computer.Display Name LIKE "%Bob's Machine%"

Computer.Display Name LIKE "Bob's Machine*" queries for: Computer.Display Name LIKE "Bob's Machine%"

Computer.Display Name LIKE "*Bob's Machine" queries for: Computer.Display Name LIKE "%Bob's Machine"

NOTE: Query statements are executed in the order shown
If no groupings are made, the query statements listed in this dialog are executed in order from the bottom up. Be sure to group related query items so they're evaluated as a group; otherwise, the results of your query may be different than you expect.

Running database queries

To run a query
  1. In the network view, expand the query groups to locate the query you want to run.
  2. Double-click the query. Or, right-click and select Run.
  3. The results (matching devices) display in the right-hand pane of the network view.

Importing and exporting queries

You can use import and export to transfer queries from one core database to another. You can import:

To import a query
  1. Right-click the query group where you want to place the imported query.
  2. Select Import from the shortcut menu.
  3. Navigate to the query you want to import and select it.
  4. Click Open to add the query to the selected query group in the network view.
To export a query
  1. Right-click the query you want to export.
  2. Select Export from the shortcut menu.
  3. Navigate to the location where you want to save the query (as an .ldms file).
  4. Type a name for the query.
  5. Click Save to export the query.