Applies to: Exchange Server 2007 SP3, Exchange Server
2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007
Topic Last Modified: 2007-01-02
This topic explains how to use the Exchange Management Shell to export and resubmit messages from queues on computers that are running Microsoft Exchange Server 2007 and that have the Hub Transport server role or the Edge Transport server role installed. You cannot use the Exchange Queue Viewer to perform this task. However, you can use the Queue Viewer to locate, identify, and suspend the messages before you perform this task.
When you export a message from a queue to a file, the message is not removed from the queue. A copy of the message is made in the specified location as a plain text file that has an .eml file name extension. The resulting .eml file can be resubmitted by using the Replay directory on any Hub Transport server or Edge Transport server inside or outside the Exchange organization.
Before You Begin
To perform the following procedures, the account you use must be delegated the following:
- Exchange Server Administrator role and local Administrators
group for the target server
To perform the following procedures on a computer that has the Edge Transport server role installed, you must log on by using an account that is a member of the local Administrators group on that computer.
For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server 2007, see Permission Considerations.
Before you resubmit exported messages by using the Replay directory, you must follow these steps:
- Verify the following information about the target directory
location:
- The target directory must exist before you export any messages.
The directory will not be created for you. If an absolute path is
not specified, the current Exchange Management Shell working
directory is used.
- The path may be local to the server that is running
Exchange 2000 Server. Or it may be a Universal
Naming Convention (UNC) path of a share on a remote server.
- Your account must have the Write permission to the target
directory.
- The target directory must exist before you export any messages.
The directory will not be created for you. If an absolute path is
not specified, the current Exchange Management Shell working
directory is used.
- Locate and identify the messages to be exported. For
information about how to view messages, see How to View
Messages.
- Suspend the messages to be exported to prevent their delivery
during the export process. The messages must be in a suspended
state for the export process to be successful. You can export
messages from remote delivery queues, mailbox delivery queues, the
Unreachable queue, or the poison message queue. Messages that are
in the poison message queue are already in a suspended state. You
cannot suspend or export messages that are in the Submission queue.
For information about how to suspend messages, see How to Suspend
Messages.
- Define the scope of messages that you want to export. You can
export individual messages, all messages from a specific queue, or
messages that match specific criteria from any queue. For more
information about how to export messages from queues, see How to Export Messages
from Queues.
Exporting Queues and Resubmitting
Consider the following two basic scenarios when you export messages from a queue for resubmission:
- Exporting messages from queues for immediate
resubmission This scenario involves the export
of messages from the queues directly to the Replay directory of the
local server or to any remote Hub Transport server or Edge
Transport server by mapping a drive letter to the remote server's
Replay directory.
- Exporting messages from queues for delayed
resubmission This scenario involves the export
of messages from the queues to a local directory, and then manually
copying of the message files to the Replay directory on the current
server or to the Replay directory on a remote Hub Transport server
or Edge Transport server.
The export procedure is the same for both scenarios. The only difference is the target directory of the exported messages. If the target directory is the Replay directory on a remote Exchange 2007 Hub Transport server or Edge Transport server, it may be easier to export the message files to a local directory first. It is easier to troubleshoot and fix any problems that occur during the manual file copy than during the message export if the remote Exchange 2007 server exists in a different domain, forest, or subnet.
You should also consider the items in the following list as you plan to export queued messages to files for resubmission:
- The export of messages from a queue doesn't remove the messages
from the queue. After you export the messages and successfully
resubmit them by using the Replay directory, you should remove the
suspended messages to avoid duplicate message delivery. For more
information about how to remove messages from a queue, see How to Remove Messages
from Queues.
- You can export messages to files by using automatic file naming
if you specify an export path to a directory that already exists.
If the target directory already exists, the file name of each
message is automatically set to InternalMessageID.eml where
InternalMessageID is the message identifier that is assigned
by the Exchange 2007 server that is currently processing the
message.
- If message files are to be processed by the Replay directory,
they must meet the following requirements:
- The file must be plain text format. MIME extensions are
supported.
- The file must have an .eml file name extension.
- The file must have at least one valid e-mail address in the
X-Sender:
header field, and one valid e-mail address in theX-Receiver:
header field.
- The file must be plain text format. MIME extensions are
supported.
- The default location for the Replay directory on a Hub
Transport or Edge Transport server is C:\Program
Files\Microsoft\Exchange Server\TransportRoles\Replay. You can
change this location by using the ReplayDirectoryPath
parameter in the Set-TransportServer cmdlet. If the value of
ReplayDirectoryPath is set to
$null
, the Replay directory is disabled.
Exporting Messages from Queues Directly to the Local Replay Directory for Immediate Delivery
To use the Exchange Management Shell to export messages from queues directly to the local Replay directory for immediate delivery
-
Run the following command:
Copy Code Get-Message -Queue "<QueueIdentity>" | Export-Message -Path "<LocalReplayDirectoryPath>"
For example, to export a copy of all the messages from the "Contoso.com" remote delivery queue on the local Exchange 2007 server to the default Pickup directory, run the following command:
Copy Code Get-Message -Queue "contoso.com" | Export-Message -Path "C:\Program Files\Microsoft\Exchange Server\TransportRoles\Replay"
-
After you have verified successful message delivery, remove the suspended messages that you exported from the queue on the source Exchange 2007 server.
Exporting Messages from Queues to a Local Directory for Delayed Delivery
To use the Exchange Management Shell to export messages from queues to a local Directory for delayed delivery
-
Run the following command:
Copy Code Get-Message -Queue "<QueueIdentity>" | Export-Message -Path "<LocalDirectoryPath>"
For example, to export a copy of all the messages from the "Contoso.com" remote delivery queue on the server named Exchange01 to the directory "C:\Contoso Export" on the local computer, run the following command:
Copy Code Get-Message -Queue "Exchange01\contoso.com" | Export-Message -Path "C:\Contoso Export"
-
Copy the exported message files to the Replay directory on another Hub Transport server or Edge Transport server.
-
After you have verified successful message delivery, remove the suspended messages that you exported from the queue on the source Exchange 2007 server.
For detailed syntax and parameter information, see Get-Message.
For More Information
For more information about queues, see Managing Queues.