Count emails sitting in a specific queue across multiple Exchange servers

Doing some testing today, I needed to check how many emails were sitting in Exchange queues across 6 different transport servers. The queues in question were outbound queues for journaling.

Since the queues on each server have a numeric name that’s of no use for this, I was able instead to search based on the next hop domain. All of our journal queues point to smart hosts with “journal” in the FQDN.

Here’s how I got the total count of messages sitting in the 6 queues:

Get-TransportServer | Get-Queue | Where-Object {$_.NextHopDomain -like "*journal*"} | Measure-Object -Sum -Property MessageCount

An alternative, which I discovered afterwards, would be to filter directly on Get-Queue instead of piping all of the queues to Where-Object:

Get-TransportServer | Get-Queue -Filter "NextHopDomain -like '*journal*'" | Measure-Object -Sum -Property MessageCount

Further Reading:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s