Applies to: Exchange Server 2007
Topic Last Modified: 2007-06-05
Use the Export-Mailbox cmdlet to move the contents of a mailbox to a specified mailbox folder.
Syntax
export-Mailbox -Identity <MailboxIdParameter>
-TargetFolder <String> -TargetMailbox
<MailboxIdParameter> [-AllContentKeywords <String[]>]
[-AttachmentFilenames <String[]>] [-BadItemLimit
<Int32>] [-ContentKeywords <String[]>] [-DeleteContent
<SwitchParameter>] [-EndDate <DateTime>]
[-ExcludeFolders <MapiFolderPath[]>] [-GlobalCatalog
<Fqdn>] [-IncludeFolders <MapiFolderPath[]>] [-Locale
<CultureInfo>] [-MaxThreads <Int32>] [-ReportFile
<LocalLongFullPath>] [-StartDate <DateTime>]
[-SubjectKeywords <String[]>] [-ValidateOnly
<SwitchParameter>]
|
Parameters
Parameter | Required | Type | Description | ||
---|---|---|---|---|---|
Identity |
Required |
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter |
The Identity parameter specifies the mailbox from which to export contents. You can use the following values:
If the Get-Mailbox command object is piped, this parameter is not required. |
||
TargetFolder |
Required |
System.String |
The TargetFolder parameter specifies the top-level mailbox folder that will be created on the mailbox specified by the TargetMailbox parameter. This folder will contain a subfolder called Recovered Data - <source mailbox alias> - <date time stamp>. The subfolder contains the exported data. If the target folder that you specify already exists on the target mailbox, the exported data will be added to the existing folder. If the target folder does not exist, it will be created. |
||
TargetMailbox |
Required |
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter |
The TargetMailbox parameter specifies the mailbox where the target folder will be created. The mailbox that you specify must exist for the command to complete successfully. |
||
AllContentKeywords |
Optional |
System.String[] |
The AllContentKeywords parameter specifies the keywords of the content to include in the move. If the command finds a keyword that you specify in the message body, attachment content, or subject, it will export those messages.
|
||
AttachmentFilenames |
Optional |
System.String[] |
The AttachmentFilenames parameter specifies the filter for attachments. You can use wildcard characters in the string. For example, you can use "*.txt" to export items that have a .txt extension. |
||
BadItemLimit |
Optional |
System.Int32 |
The BadItemLimit parameter specifies the number of corrupted items in a mailbox to skip before the export operation fails. |
||
ContentKeywords |
Optional |
System.String[] |
The ContentKeywords parameter specifies the keywords of the content to include in the move. If the command finds a keyword that you specify in the message body or in the attachment content, it will export those messages. |
||
DeleteContent |
Optional |
System.Management.Automation.SwitchParameter |
The DeleteContent parameter specifies the option to delete the content from the source mailbox after it has been exported to a folder. The source folder will not be deleted. |
||
EndDate |
Optional |
System.DateTime |
The EndDate parameter specifies the end date for filtering content that will be exported from the source mailbox. Only items in the mailbox whose date is prior to or the same as the end date will be exported. When you enter a specific date, use the short date format that is defined in the Regional Options settings that are configured on the local computer. For example, if your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006. |
||
ExcludeFolders |
Optional |
Microsoft.Exchange.Data.Mapi.MapiFolderPath[] |
The ExcludeFolders parameter specifies the list of folders to exclude during the export. |
||
GlobalCatalog |
Optional |
Microsoft.Exchange.Data.Fqdn |
The GlobalCatalog parameter specifies the global catalog to use to search for the target mailbox. |
||
IncludeFolders |
Optional |
Microsoft.Exchange.Data.Mapi.MapiFolderPath[] |
The IncludeFolders parameter specifies the list of folders to include during the export. |
||
Locale |
Optional |
System.Globalization.CultureInfo |
The Locale parameter specifies the locale of messages to export. The command will export only messages with the locale that you specify. |
||
MaxThreads |
Optional |
System.Int32 |
The MaxThreads parameter specifies the maximum number of threads to use. |
||
ReportFile |
Optional |
Microsoft.Exchange.Data.LocalLongFullPath |
The ReportFile parameter specifies the path and file name for the XML report log. |
||
StartDate |
Optional |
System.DateTime |
The StartDate parameter specifies the start date for filtering content that will be exported from the source mailbox. Only items in the mailbox whose date is later than the start date will be exported. When you enter a specific date, use the short date format that is defined in the Regional Options settings that are configured on the local computer. For example, if your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006. |
||
SubjectKeywords |
Optional |
System.String[] |
The SubjectKeywords parameter specifies the keyword filters for subjects of items in the source mailbox. |
||
ValidateOnly |
Optional |
System.Management.Automation.SwitchParameter |
The ValidateOnly parameter instructs the command to simulate the actions that it would take on the object. By using the ValidateOnly parameter, the administrator can view what changes would occur without having to apply any of those changes.
|
Detailed Description
To run the Export-Mailbox cmdlet, the account you use must be delegated the following:
- Exchange Server Administrator role and local Administrators
group for the target server
For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server 2007, see Permission Considerations.
You cannot export data from a mailbox in one forest to a mailbox in a different forest. The source and target mailboxes must be in the same forest.
The Export-Mailbox cmdlet exports all empty folders and special folders to the target location. The special folders are the following:
- Inbox
- Deleted Items
- Drafts
- Junk E-Mail
- Outbox
- Sent Items
- Journal
- Calendar
- Contacts
- Notes
- Tasks
The Export-Mailbox cmdlet also exports messages from the dumpster. For more information about messages in the dumpster, see How to Recover a Deleted Item.
Input Types
Return Types
Errors
Error | Description |
---|---|
|
Exceptions
Exceptions | Description |
---|---|
|
Example
The first example shows how to export the contents of the mailbox of user john@contoso.com to the folder MyData on the mailbox ExportMailbox.
The second example shows how to use filters to specify which items in the source mailbox to include in the export. This example exports all items from the mailbox of user contoso\john that have the keyword "merger" in the message body or in the content of an attachment, have an attachment that is named *orgchart*, and have a date that is later than 03/01/2006 at 12:01:00 A.M.
The third example shows how to find and delete items from a mailbox. This example first gets all the mailboxes on database DB1 and searches for items that contain the string "Virus message" in the subject. It will export the items to another mailbox and will delete those items from the source mailbox.
The fourth example shows that you can pipe the output from the Get-User command to the Export-Mailbox command. This example also excludes two folders from the export. The items in the Junk E-Mail and Contacts folders in John's mailbox will not be exported to the ExportMailbox.
Note: |
---|
You can also pipe the output from Get-Recipient or Get-Mailbox to Export-Mailbox. |
Copy Code | |
---|---|
Export-Mailbox -Identity john@contoso.com -TargetMailbox ExportMailbox -TargetFolder MyData Export-Mailbox -Identity contoso\john -TargetMailbox ExportMailbox -TargetFolder MyData -ContentKeywords "merger" -AttachmentFilenames "*orgchart*" -StartDate "03/01/2006 12:01:00" Get-Mailbox -Database DB1 | Export-Mailbox -TargetMailbox ExportMailbox -TargetFolder VirusData -SubjectKeywords "Virus message" -DeleteContent Get-User john | Export-Mailbox -TargetMailbox ExportMailbox -TargetFolder MyData -ExcludeFolders "\Junk E-Mail","\Contacts" |