AND, OR, and NOT are all valid logical operators that can be used in an Microsoft System Center Configuration Manager 2007 query. Logical operators can be used to broaden or narrow the scope of a query. Additionally, Configuration Manager 2007 evaluates expressions by using a particular operator precedence, which can affect the results.

AND

Finds all objects that satisfy two criteria connected by AND. You can use AND to narrow the list of objects that you want to find. For example, you can have Configuration Manager 2007 search for all computers that have a Pentium processor AND more than 64 MB of physical memory.

OR

Finds all objects that satisfy either of the two criteria connected by the OR. You can use OR to assemble a set of objects. For example, you can have Configuration Manager 2007 search for all computers that have a Pentium processor OR more than 64 MB of physical memory.

NOT

Finds all objects that do not satisfy the following expression. You can use NOT to narrow the list of objects that you want to find. For example, you can search for all computers that have a Pentium processor and NOT more than 64 MB of physical memory.

Evaluation Order

You must understand the evaluation order of the logical operators before you can obtain the results that you want. On the Criteria tab in the Query Statement Properties dialog box, the statements are evaluated from top to bottom except for expressions in parentheses, which always come first. In WQL, expressions are evaluated in the following order:

Expressions set inside parentheses

Expressions joined by AND

Expressions joined by OR

Expressions preceded by NOT

Use group parentheses to make complex expressions easier to understand or to force a certain order of evaluation. For example, when more than one OR expression occurs within a complex query, use parentheses to indicate which expressions should be evaluated first.

For more information about logical operators, including sample query syntax that uses logical operators, see the Configuration Manager 2007 SDK.

See Also