Export (0) Print
Expand All

Export-Message

 

Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1

Topic Last Modified: 2007-06-28

Use the Export-Message cmdlet to copy a message from a queue on a computer that has the Hub Transport server role or the Edge Transport server role installed to a specified file path in a Microsoft Exchange Server 2007 organization.


Export-Message -Identity <MessageIdentity> -Path <String> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

The Export-Message cmdlet copies messages from a delivery queue, the Unreachable queue, or the poison message queue on a Hub Transport server or an Edge Transport server to a specified file path. Before you export a message, you must first suspend the message. Messages in the poison message queue are already suspended. You can use the Export-Message command to copy messages to the Replay directory of another transport server for delivery. To copy a message that is located on a remote server, include the server name as part of the message identity. The identity is mandatory and must uniquely identify a message in a queue.

To run the Export-Message cmdlet, the account you use must be delegated the following:

  • Exchange Server Administrator role and local Administrators group for the target server

To run the Export-Message cmdlet 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.

 

Parameter Required Type Description

Identity

Required

Microsoft.Exchange.Data.QueueViewer.MessageIdentity

Use the Identity parameter to specify the MessageIdentity integer. This is an integer that represents a particular message and an optional server and queue identity. The syntax for this parameter is as follows:

  • Server\QueueIdentity\MessageIdentity

  • QueueIdentity\MessageIdentity

  • You must include QueueIdentity when you use the Export-Message command. If no server name is used, the task runs on the local server.

Path

Required

System.String

Use the Path parameter to specify the path of the file where the message is exported. The value of the Path parameter can be a file name, a directory and a file name, or just a 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. The directories that are used in the Path parameter may be local to the Exchange 2007 computer, or they may be a Universal Naming Convention (UNC) path to a share on a remote server. If you specify an existing directory without a file name in the value of the Path parameter, the names of the message files are automatically set to InternalMessageID.eml. The InternalMessageID is a message identifier that is assigned by the Exchange 2007 server that is currently processing the message. Your account must have the Write permission to the target directory.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm parameter causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm parameter.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf parameter instructs the command to simulate the actions that it would take on the object. By using the WhatIf parameter, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf parameter.

 

Error Description

 

 

 

Exceptions Description

 

 

The following examples show how to export messages from a queue to a file. The first example shows how to export a single message to the specified file path.

The second example shows how to use the Get-Message command to retrieve all messages from the specified queue. The query results are then piped to the Export-Message command, and all the messages are copied to .eml files that have names that are based on the InternalMessageID.

For more information about how to use the Exchange Management Shell to perform queue viewer tasks, see Using the Exchange Management Shell to Manage Queues.

Export-Message -Identity ExchSrv1\contoso.com\1234 -Path "c:\exportfolder\filename.eml"
Get-Message -Queue "Server1\contoso.com" | Export-Message -Path "c:\exportfolder"
 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft