Comparison Operators
Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.
Applies to: Exchange Server 2007, Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3
The Exchange Management Shell has a rich set of operators that enables comparisons of one object with another object or one object with a set of objects.
For more information about comparison operators, run the following command in the Exchange Management Shell:
Get-Help About_Comparison_Operators
Table 1 lists the comparison operators that are available in the Exchange Management Shell. Some comparison operators are case-sensitive. Other comparison operators are not case-sensitive. If a comparison operator is case-sensitive, the case that is used in the strings that are being compared must match. For example, the string "Test" does not match "test" when you use a comparison operator that is case-sensitive.
Table 1 Comparison operators that are available in the Exchange Management Shell
Operator | Definition |
---|---|
-eq |
Equals (not case-sensitive) |
-ieq |
Equals (not case-sensitive) |
-ceq |
Equals (case-sensitive) |
-ne |
Not equal (not case-sensitive) |
-ine |
Not equal (not case-sensitive) |
-cne |
Not equal (case-sensitive) |
-lt |
Less than (not case-sensitive) |
-ilt |
Less than (not case-sensitive) |
-clt |
Less than (case-sensitive) |
-gt |
Greater than (not case-sensitive) |
-igt |
Greater than (not case-sensitive) |
-cgt |
Greater than (case-sensitive) |
-le |
Less than or equal to (not case-sensitive) |
-ile |
Less than or equal to (not case-sensitive) |
-cle |
Less than or equal to (case-sensitive) |
-ge |
Greater than or equal to (not case-sensitive) |
-ige |
Greater than or equal to (not case-sensitive) |
-cge |
Greater than or equal to (case-sensitive) |
-contains |
The elements in the left operand that is equal to the right operand (not case-sensitive) |
-icontains |
The elements in the left operand that is equal to the right operand (not case-sensitive) |
-ccontains |
The elements in the left operand that is equal to the right operand (case-sensitive) |
-notcontains |
The elements in the left operand that is equal to the right operand (not case-sensitive) |
-inotcontains |
The elements in the left operand that is equal to the right operand (not case-sensitive) |
-cnotcontains |
The elements in the left operand that is equal to the right operand (case-sensitive) |
-band |
Bitwise And |
-bor |
Bitwise Or |
-bnot |
Bitwise NOT |
-and |
Logical and |
-or |
Logical or |
-not |
Logical not |
-match |
Compare strings by using regular expressions (not case-sensitive) |
-notmatch |
Compare strings by using regular expressions (not case-sensitive) |
-imatch |
Compare strings by using regular expressions (not case-sensitive) |
-inotmatch |
Compare strings by using regular expressions (not case-sensitive) |
-cmatch |
Compare strings by using regular expressions (case-sensitive) |
-cnotmatch |
Compare strings by using regular expressions (case-sensitive) |
-like |
Compare strings by using wildcard rules |
-notlike |
Compare strings by using wildcard rules |
-ilike |
Compare strings by using wildcard rules (not case-sensitive) |
-inotlike |
Compare strings by using wildcard rules (not case-sensitive) |
-clike |
Compare strings by using wildcard rules (case-sensitive) |
-cnotlike |
Compare strings by using wildcard rules (case-sensitive) |