How to Export Messages from a Mail Queue on Exchange

/

This post will describe how to export all messages from a mail queue on Exchange 2010, so the mails can be resubmitted on another server.

It is based on field notes, from a recent case, where we had to move a certain queue to another server.

It is possible to export one or all messages from one specific or all queues on an Exchange Server. This post describes how to do it for Exchange 2010, but the process is quite similar on Exchange 2013.

To do the export of messages, you can use the Export-Message cmdlet, which is part of Exchange. If you want to resubmit the exported mails (now .eml files), then put them into the replay directory on another Exchange server.

The default directory for the Replay Directory (on Exchange 2010) is:

C:Program FilesMicrosoftExchange ServerV14TransportRolesReplay

 

The script I used to Export all messages (mails) from the Exchange Queue is:

#Suspend all messages in the queue
get-queue ExchangeServer663 | Get-Message | Suspend-Message
#Get all messages from the queue
$array = @(Get-Message -Queue "ExchangeServer663" -ResultSize unlimited)
#Export all messages from the queu
$array | ForEach-Object {$i++;Export-Message $_.Identity | AssembleMessage -Path ("E:Mailqueue"+ $i +".eml")}

 

Find your Queue ID (Mine was ExchangeServer663) using Get-Queue.

 

Reference documentation from TechNet:

5 thoughts on “How to Export Messages from a Mail Queue on Exchange”

  1. Worked great, thanks.
    Text above has edited out your “backslashes”… might be worth an edit, given that this just rescued the last 24 hours of inbound mail for me… total great!!

  2. Hi,

    what happens to the messages that are still in suspended state?
    you have to manually delete them or this process removes them automatically?

    Thanks,
    RZKjr

Comments are closed.