How to Export Messages from a Mail Queue on Exchange

3

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:

About Author

Peter is an Exchange specialist with over 15+ years of experience with Exchange Server and certified Microsoft Certified Master (MCM) and Microsoft Certified Solutions Master (MCSM) on Exchange Server. He has been awarded the Microsoft MVP award, every year since 2007. He is active in the Microsoft community and User Group Leader for CoLabora (a danish UC & Cloud User Group). He works as an Cloud & Infrastructure Architect and Consulent, with primary focus on Exchange, Office 365, Azure and Skype for Business.

3 Comments

  1. Pingback: NeWay Technologies – Weekly Newsletter #93 – May 1, 2014 | NeWay

  2. Pingback: NeWay Technologies – Weekly Newsletter #93 – May 2, 2014 | NeWay

  3. Andrew Bienhaus on

    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!!

Leave A Reply

Copyright 2005-2015 - Peter Schmidt.