Exchange Mail Queue Management CMDlets

Exchange Mail Queue Management PowerShell CMDlets

Get Message Queue information

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

Get Queue Details

Get-Queue –Server <server name> | 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 organization 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 ‘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”}

Similar Posts

  • Managed Availability Components – Exchange 2016​

    Managed Availability Components Probes The first component is called a Probe. Probes are responsible for taking measurements on the server and collecting data. There are three primary categories of probes: recurrent probes, notifications, and checks. Recurrent probes are synthetic transactions performed by the system to test the end-to-end user experience. Checks are the infrastructure that perform…

  • Exchange Message Content conversion

    Microsoft Exchange Mail routing Message Content Conversion Process.   Content conversion   Content conversion is the process of correctly formatting a message for each recipient. The decision to perform content conversion on a message depends on the destination and format of the message. They types of content conversion that occur in Exchange 2016 and Exchange 2019…

  • Autodiscover Overview

    Autodiscover Overview The Autodiscover component is responsible for helping clients locate Exchange services (such as EWS). It greatly improves the user experience, most often during the initial setup of client computers and mobile devices (by auto-populating profile information). Let’s look at the three parts of Autodiscover to walk through how it works. In the screen…

  • | |

    Mailbox Move CMDlets

    Exchange Mailbox Move PowerShell Commands Move the user mailbox to Database DB01 New-MoveRequest -Identity ‘username@example.com’ -TargetDatabase “DB01” New-MoveRequest -Identity ‘username@example.com’ -TargetDatabase “DB01” -BadItemLimit 100  Move the bulk users mailbox to Database DB01  Create CSV file having the email address of the users and name it as “EmailAddress.csv” ForEach ($User in Get-Content “C:\temp\EmailAddress.csv”){ New-MoveRequest -Identity $user…

  • |

    Exchange Event Logs CMDlets

    Exchange Event Log Powershell CMDlets To view only the Exchange-related services that are currently running Get-Service *exch* | Where-Object {$_.Status -eq ‘Running’} The following example retrieves the services from every Exchange server in the organization: Get-ExchangeServer | ForEach-Object {Get-Service *exch* -ComputerName $_.Name |Where-Object {$_.Status -eq ‘Running’}} Get Events after specified Date Get-EventLog -LogName application -after…

Leave a Reply

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