Mail Queue Management CMDlets

Get Message Queue information
Get-transportserver | Get-Queue –SortOrder: -MessageCount

Get Queue Details
Get-Queue –Server EX10CHM01 | Sort-Object -Property Messagecount | FT Identity, DeliveryType, NextHopDomain, Status, MessageCount, LastRetryTime, LastError -autosize

Move Messages to Another Working Queue
In the event a Hub Transport server is completely out, you may have the requirement to move all messages in a queue to another Hub Transport server in your organisation to ensure the messages are delivered.  How can you do this?

First you need to export all messages in the current queue.  You can do this with the following powershell commands:

$array = @(Get-Message -Queue “QueueName” -ResultSize unlimited)
$array | ForEach-Object {$i++;Export-Message $_.Identity | AssembleMessage -Path (“c:\MailsExport\”+ $i +”.eml”)}
To import the messages into the new Hub Transport server, simply place the .eml files into the Transport Pickup folder.  The new server should immediately start processing the messages.


Get Specific Queue
Get-Queue Server\Queue

Get all Queues and sort by Message Count
Get-TransportServer | Get-Queue -sortorder: -messagecount

Get all Queues with Retry Status sorted by messagecount
Get-TransportServer | Get-Queue -sortorder: -messagecount | where {$_.Status -eq “Retry”} | fl

Get Queues greater than 25
Get-TransportServer | Get-Queue -Filter {MessageCount -gt 25}

Retry Queues where the next hop domain is ‘’
Retry-Queue -Filter {NextHopDomain -eq “” -and Status -eq “Retry”}

Resume Queues on Server1 where the next hop domain is ‘’
Resume-Queue -Server Server1 -Filter {NextHopDomain -eq “”}

This example suspends processing on all queues on server that have more than 100 messages in the queue.
Suspend-Queue -Server -Filter {MessageCount -gt 100}

This example suspends processing on all queues holding messages for delivery to the domain and that currently have a status of Retry.
Suspend-Queue -Filter {NextHopDomain -eq “” -and Status -eq “Retry”}

Categories: Exchange Server

Tags: , , ,

We look forward to hearing your feedback..

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: