Microsoft Exchange Message Export and Import

I had faced a strange Microsoft Exchange issue last week, messages were getting stuck in the submission queue of an Exchange 2010 SP3 Hub Transport server possibly due to an issue on the Transport Rule Agent.

While troubleshooting the issue, since there were a lot of messages in the queue, around two thousands, I decided to export them and import them on the second Hub Transport server.

In order to export the messages I used the following command:

$messages = Get-Message -Queue "EXCHANGESERVER\Submission"
ForEach($m in $messages)
    $Temp = "C:\Messages\" + $m.InternetMessageID + ".eml"
    $Temp = $Temp.Replace("<","_")
    $Temp = $Temp.Replace(">","_")
    $Temp = $Temp.Replace("\\","_")
    Export-Message $m.Identity |
        AssembleMessage -Path $Temp

 I used the Get-Message cmdlet to get all the messages in the server's submission queue and then exported each message to a file in the c:\messages folder.

Make sure you have enough disk space in the disk where you are going to export the messages!

When the export is completed, you can copy the messages to the Pickup directory on another Hub Transport server and Exchange will pick them up and send them. You do not have to remove the messages from the queue since they will not be delivered again if the service is restored, but I usually do so.

To avoid searching the internet for the pickup folder path, you may find it in the TransportRoles directory in the Exchange Server program files installation path.

One more thing, when importing the messages on the server, I always start with a few messages and wait to see what happened on the message tracking log and if everything is OK, I release more messages.

Popular posts from this blog

IIS Client Certificate Revocation Check Disable

Configuring a Certificate on Exchange Receive Connector

How to Configure Message Forwarding on a Mailbox Level