On Mailbox servers and Edge Transport servers in Exchange Server, you can export the messages in a queue to files. The exported messages aren't removed from the queue. Copies of the messages are made in the specified location as a plain text files. You can view the message files in Notepad or Outlook, and you can resubmit the message files by using the Replay directory on any other Mailbox server or Edge Transport server inside or outside your Exchange organization.
What do you need to know before you begin?
Estimated time to complete each procedure: 5 minutes
You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Queues" entry in Mail flow permissions topic.
To export messages from a delivery queue, the Submission queue, or the Unreachable queue, the messages need to be in the Suspended state. For active, healthy queues, you first suspend the queue so you can then suspend the messages. Messages in the poison message queue are already in the Suspended state. For more information, see Suspend queues and Suspend messages in queues.
You can't use Queue Viewer in the Exchange Toolbox to export messages. However, you can use Queue Viewer to locate, identify, and suspend the messages before you export them using the Exchange Management Shell. For more information about Queue Viewer, see Queue Viewer. To learn how to open the Exchange Management Shell in your on-premises Exchange organization, see Open the Exchange Management Shell.
When you export messages from a queue, you don't remove the messages from the queue. If you resubmit the exported messages by using the Replay directory, you should remove the messages from the queue to avoid duplicate message delivery. For more information, see Remove messages from queues.
Verify the following information about the target location for the exported message files:
The target folder needs to exist before you export any messages, and won't be created for you. If you don't specify the complete path, the files are written to the current Exchange Management Shell working directory.
The path can be local to the Exchange server, or it can be a UNC path to a share on a remote server (\server\share).
Your account needs to have the Write permission in the target folder.
We use the message's InternetMessageID property value for the exported message file names to help ensure uniqueness. The procedures include steps to remove angled brackets (> and <), because they aren't allowed in file names. Also, we use the .eml file name extension so you can easily open the files in Outlook or resubmit the files by using the Replay directory.
For more information about identity and filters for queues and messages in queues, see the following topics:
Use the Exchange Management Shell to export specific messages from all queues on a server
To export specific messages from all queues on a server, and use the InternetMessageID value of each message as the file name, use the following syntax: