Filtering Queues

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

You can manage queues by using the Exchange Queue Viewer graphical user interface and commands in the Microsoft Exchange Management Shell in Microsoft Exchange Server 2007. The list of queues can be very large, depending on current mail flow. The list of queues can also frequently change when messages enter and leave the server. By filtering queues, you can adjust your search to specific criteria and locate queues that are experiencing a mail flow problem. You can then perform operations that modify the status of those queues.

Queue Filtering Scenarios

Filtering generates different views of the queues. You use the queue properties as filter options. By specifying filter criteria, you can quickly locate queues and take action on them. The following scenarios are examples of how you can use queue filtering to manage message flow:

  • You receive a message from the Microsoft Operations Manager (MOM) that indicates that a queue length has exceeded the established threshold. You want to investigate whether a server-wide mail flow problem exists.

    You can create a filter to view all the queues that have a message count that exceeds what you consider typical. If a mail flow problem is indicated, you can select all the queues in the filter results and suspend the queues while you continue to investigate.

  • You suspend several queues to investigate the cause of mail flow problems. You determine that the problem was caused by an incorrect connector configuration and is now fixed.

    You can create a filter to view all the queues that have a status of Suspended, and then select all the queues in the filter results and resume the queues.

Queue Properties to Use When Filtering Queues

You can use the queue properties to create a filter and locate queues that meet specified criteria. Table 1 lists the queue properties by which you can filter and the valid values for those properties.

Table 1   Queue properties

Queue Viewer queue property Exchange Management Shell queue property Property type Value

Delivery Type

DeliveryType

Enumeration

This value is determined by the next hop selection. The next hop selection identifies where messages are queued for delivery. To use the delivery type property in a filter, you must use the constant values that are assigned to each type. The delivery type can be one of the following values:

  • DNSConnectorDelivery   The messages are queued for delivery to an external recipient by using a Simple Mail Transfer Protocol (SMTP) connector that is located on the local server and that is configured to use Domain Name System (DNS) for routing resolution.

  • NonSmtpGatewayDelivery   The messages are queued for delivery to an external recipient by using a non-SMTP connector on the local server.

  • SmartHostConnectorDelivery   The messages are queued for delivery to an external recipient by using an SMTP connector that is located on the local server and that is configured to use a smart host for routing resolution.

  • SmtpRelayWithinAdSitetoEdge   The messages are queued for delivery to an external recipient by using an SMTP connector that is located on an Edge Transport server that is subscribed to the local Active Directory site.

  • MapiDelivery   The messages are queued for delivery to recipients that have mailboxes that are located on a mailbox server that is located in the local Active Directory site.

  • SmtpRelayWithinAdSite   The messages are queued for delivery to a Hub Transport server that is located in the same Active Directory site as the local server. The destination server can be the source server for an SMTP connector, the source server of a routing group connector, or an expansion server.

  • SmtpRelaytoRemoteAdSite   The messages are queued for delivery to a server that is located in a remote Active Directory site. The destination server can be the source server for a connector that is configured to transport messages for external recipients, an expansion server, or a Hub Transport server that delivers messages addressed to mailbox recipients that are located in the remote Active Directory site.

  • SmtpRelaytoTiRg   The messages are queued for delivery to an Exchange Server 2003 routing group. The destination server can be the source server for a connector that is configured to transport messages for external recipients, an expansion server, or an Exchange Server 2003 bridgehead server that delivers messages addressed to mailbox recipients that are located in the routing group.

  • Undefined   The messages are located in the Submission queue, and the next hop destination has not yet been resolved.

  • Unreachable   The messages are located in the Unreachable queue, and a route to the recipient could not be established.

Identity

Identity

QueueIdentity

This value specifies the identity of the queue. Enter the queue identity in the form of Server\destination, where destination is a remote domain, mailbox server, persistent queue name, or the integer that identifies this queue in the queuing database.

Last Error

LastError

String

A text string of the last error that was recorded for a queue.

Last Retry Time

LastRetryTime

DateTime

This value specifies the time of the last connection attempt for a queue that has a status of Retry.

Message Count

MessageCount

Ulong

This value is expressed as an integer that represents the number of items in the queue.

Next Hop Connector

NextHopConnector

GUID

This value is expressed as a system GUID and is the GUID of the connector that was used to create the queue.

Next Hop Domain

NextHopDomain

String

This value specifies the next destination of a delivery queue. The next hop domain can be expressed as follows:

  • Remote SMTP domain name

  • Exchange server name

  • Connector name

  • Routing group

  • Active Directory site name

  • Mailbox server fully qualified domain name (FQDN)

Next Retry Time

NextRetryTime

DateTime

This value specifies the time of the next connection attempt for a queue that has a status of Retry.

Status

Status

Enumeration

The current queue status. A queue can have one of the following status values:

  • Active

  • Suspended

  • Ready

  • Retry

Operators to Use When Filtering Queues

When you create a queue filter, you must include an operator for the property value to match. Table 2 shows the comparison operators that you can use in a filter expression and how each operator functions.

Table 2   Filter expression operators

Operator Exchange Management Shell value Function Exchange Management Shell code example

Equals

-eq

This operator is used to specify that the results must exactly match the property value that is supplied in the expression.

To display a list of all queues that have a status of Retry:

Get-queue -filter {status -eq "retry"}

Does Not Equal

-ne

This operator is used to specify that the results should not match the property value that is supplied in the expression.

To display a list of all queues that do not have a status of Active:

Get-queue -filter {status -ne "active"}

Greater Than

-gt

This operator is used with properties where the value is expressed as an integer. The filter results only include queues where the value of the specified property is greater than the value that is supplied in the expression.

To display a list of queues that currently contain more than 1,000 messages:

Get-queue -filter {messagecount -gt 1000}

Greater Than or Equals

-ge

This operator is used with properties where the value is expressed as an integer. The filter results only include queues where the value of the specified property is greater than or equal to the value that is supplied in the expression.

To display a list of queues that currently contain 1,000 or more messages:

Get-queue -filter {messagecount -ge 1000}

Less Than

-lt

This operator is used with properties where the value is expressed as an integer. The filter results only include queues where the value of the specified property is less than the value that is supplied in the expression.

To display a list of queues that currently contain less than 1,000 messages:

Get-queue -filter {messagecount -lt 1000}

Less Than or Equals

-le

This operator is used with properties where the value is expressed as an integer. The filter results only include queues where the value of the specified property is less than or equal to the value supplied in the expression.

To display a list of queues that currently contain 1,000 or fewer messages:

Get-queue -filter {messagecount -le 1000}

Contains

-like

This operator is used with properties where the value is expressed as a text string. The filter results only include queues where the value of the specified property contains the text string that is supplied in the expression. You can include the * wildcard character in a -like expression that is applied to a text string field, but not with a field that has the enumeration type.

To display a list of delivery queues that have a destination to any SMTP domain that ends in Contoso.com:

Get-queue -filter {identity -like "*Contoso.com"}

You can specify multiple expressions in your queue filter by using the -and operator in the Exchange Management Shell or by adding multiple expressions in the Queue Viewer. Queues must meet all criteria to be included in the result set. For example, the results of the following command will display a list of queues that have a destination to any SMTP domain name that ends in Contoso.com and that currently contain more than 500 messages:

Get-queue -Filter {Identity -like "*Contoso.com*" -and MessageCount -gt 500}

For more information about how to use comparison operators in the Exchange Management Shell, run the following command in the Exchange Management Shell:

Help about_comparison_operator

For More Information

For more information about managing and filtering queues, see the following topics: