Mail Queue Management CMDlets

Home/Exchange Server/Mail Queue Management CMDlets

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 ServerQueue

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”}

Please feel free to share.
By | 2013-07-23T23:17:07+00:00 July 23rd, 2013|Exchange Server|0 Comments

About the Author:

Leave A Comment