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.

Source: http://clintboessen.blogspot.com/search?updated-max=2012-09-04T19:50:00-07:00&max-results=30

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 ‘domain.com’
Retry-Queue -Filter {NextHopDomain -eq “domain.com” -and Status -eq “Retry”}

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

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

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

Please feel free to share.

Related News

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyrıght 2013 FUEL THEMES. All RIGHTS RESERVED.

Enjoy this blog? Please spread the word :)