Share via


How to Export Mailbox Data

Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

 

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

This topic explains how to use the the Export-Mailbox cmdlet in the Exchange Management Shell to export mailbox data from one mailbox to a folder in another mailbox. New functionality is added to the Export-Mailbox cmdlet in Exchange Server Service Pack 1 (SP1).

Note

You cannot use the Exchange Management Console to export mailbox data.

What Data Is Exported

By default, the Export-Mailbox cmdlet exports all empty folders, special folders, and subfolders to the target location. To specify which folders to include in the export, use the IncludeFolders parameter. To specify which folders to exclude from the export, use the ExcludeFolders parameter.

By default, the following special folders are exported when you use the Export-Mailbox cmdlet:

  • Inbox

  • Deleted Items

  • Drafts

  • Junk E-Mail

  • Outbox

  • Sent Items

  • Journal

  • Calendar

  • Contacts

  • Notes

  • Tasks

The Export-Mailbox cmdlet exports all message types, including messages, calendar items, contacts, distribution lists, journal entries, tasks, notes, and documents. However, the Export-Mailbox cmdlet does not export rules.

The Export-Mailbox cmdlet also exports messages from the dumpster. Messages from the dumpster are converted to regular items in the folder or .pst file to which you export data.

Note

If you use any keyword parameters, the Export-Mailbox cmdlet will first export all of the messages, including messages in the dumpster, and then search the target mailbox for messages that meet the keyword criteria. Messages that were in the dumpster on the source mailbox are converted to regular messages in the Deleted Items folder on the target mailbox and will also be searched for keywords. The Export-Mailbox cmdlet then deletes messages on the target mailbox that do not match the keyword criteria. If you also use the DeleteContent parameter, Export-Mailbox will then delete the messages that match the keyword criteria from the source mailbox.

For more information about messages in the transport dumpster, see How to Recover a Deleted Item.

Where Data Is Exported

Data is exported to a subfolder in a destination mailbox and folder that you specify. To specify the destination mailbox, use the TargetMailbox parameter. To specify the folder on the destination mailbox, use the TargetFolder parameter. The TargetFolder parameter specifies the top-level mailbox folder that is created on the destination mailbox. This folder contains a subfolder named Recovered Data - <Source_Mailbox_Alias> - <Date_Time_Stamp>. The subfolder contains the exported folders and messages.

If the target folder that you specify already exists on the target mailbox, the exported data is added to the existing folder. If the target folder does not exist, it is created.

New in Exchange 2007 Service Pack 1 (SP1)

Exchange 2007 Service Pack 1 (SP1) introduces the following functionality for exporting mailbox data:

  • You can export mailbox data from a mailbox to a .pst file. To export to a .pst file, use the PSTFolderPath parameter to specify the path to the .pst file to which data will be exported. You cannot export data to a .pst file from a mailbox that is in a recovery storage group (RSG).

  • You can merge the data that you export into an existing target folder by using the AllowMerge parameter. In Exchange 2007 SP1, if you specify the AllowMerge parameter, the name of the subfolder will not include a date-time stamp. In Exchange 2007 SP1, you can specify a path to a .pst file to which data will be exported instead of specifying a target mailbox and target folder.

  • You can use the DeleteAssociatedMessages parameter to delete associated messages in the export process. Or, use the IncludeAssociatedMessages parameter to include associated messages in the export process. Associated messages contain hidden data with information about rules, views, and forms.

  • If you use the DeleteContent parameter and do not specify the TargetMailbox parameter, you can delete content from the source mailbox without exporting it to another mailbox.

  • You can filter the messages that are exported based on recipients and senders. To filter on recipients, use the RecipientKeywords parameter. To filter on the sender, use the SenderKeywords parameter.

For more information about the new functionality that is introduced by Exchange 2007 SP1, see the Export-Mailbox topic.

For more information about the functionality prior to Exchange 2007 SP1, see the Export-Mailbox (RTM) topic.

Before You Begin

To perform this procedure, the account you use must be delegated the following:

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

  • Full access to the source and target mailboxes

For more information about permissions, delegating roles, and the rights that are required to administer Exchange 2007, see Permission Considerations.

Also, before you perform this procedure, be aware of the following:

  • To use the Export-Mailbox cmdlet, the source mailbox and target mailbox must be in the same forest. You cannot export data from a mailbox in one forest to a mailbox in a different forest.

  • You cannot export data from a public folder database.

  • To grant full access to a mailbox, use the Add-MailboxPermission cmdlet and specify FullAccess for the AccessRights parameter. For example, if Admin01 needs to export data from John's mailbox to a mailbox called Export, you must first run the following commands:

    Add-MailboxPermission -Identity john -User Admin01 -AccessRights FullAccess
    Add-MailboxPermission -Identity Export -User Admin01 -AccessRights FullAccess
    
  • To export data from an Exchange 2003 or Exchange 2000 mailbox, the account you use must be delegated the Exchange Administrator role for the administrative group in which the server resides.

  • To export data from a .pst file, you must run the Export-Mailbox cmdlet from a 32-bit computer that has the following installed:

    • The 32-bit version of the Exchange management tools

    • Outlook 2003 Service Pack 2 (SP2) or Outlook 2007

    For information about Exchange 2007 management tools 32-bit download, see Microsoft Exchange Server 2007 Management Tools (32-Bit).

  • If you export data to a folder in another mailbox, the target mailbox that you specify must exist before you run the command.

Procedure

Exchange 2007 SP1

To use the Exchange Management Shell to export mailbox data in Exchange 2007 SP1

  • To export the special folders and empty folders of the mailbox to a folder in the destination mailbox, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -TargetMailbox <MailboxIdParameter> -TargetFolder <Folder_Name>
    
  • To export data to a .pst file, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -PSTFolderPath <Path_Of_PST_Folder>\<File_Name>.pst
    
  • To export data from a group of mailboxes, such as all mailboxes for which the user title begins with "VP," run the following command:

    Get-User | where { $_.Title -ilike "VP*" } | Export-Mailbox -TargetFolder <Folder_Name> -TargetMailbox <MailboxIdParameter>
    
  • To export data that was received between specific dates to a .pst file, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -StartDate "<Month/Day/Year>" -EndDate "<Month/Day/Year>" -PSTFolderPath <Path_Of_PST_Folder>\<File_Name>.pst
    
  • To export only data from the Sent Items folder, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -IncludeFolders '\Sent Items' -TargetFolder <Target_Folder_Name> -TargetMailbox <MailboxIdParameter>
    
  • To exclude folders from the export, such as excluding items in the Junk E-Mail and Contacts folders, run the following command:

    Export-Mailbox -TargetMailbox <MailboxIdParameter> -TargetFolder <Target_Folder_Name> -ExcludeFolders "\Junk E-Mail","\Contacts"
    
  • To use filters to specify which items in the source mailbox to include in the export, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -TargetMailbox <MailboxIdParameter> -TargetFolder <Target_Folder_Name> -ContentKeywords "<String[]>" -AttachmentFilenames "<String[]>" -StartDate "<Month/Day/Year> <Time>" -RecipientKeywords <String[]>
    
  • To find and delete items from a group of mailboxes, such as all mailboxes on a database, run the following command:

    Get-Mailbox -Database DB1 | Export-Mailbox -TargetMailbox ExportMailbox -TargetFolder VirusData -SubjectKeywords "Virus message" -DeleteContent
    

    This example first gets all the mailboxes on database DB1 and then searches for items that contain the string "Virus message" in the subject line. It will export the items to the mailbox ExportMailbox and will delete those items from the source mailbox.

  • To find and delete items from a group of mailboxes, such as all mailboxes on a database, without exporting the items to another mailbox, run the following command:

    Get-Mailbox -Database DB1 | Export-Mailbox -SubjectKeywords "Virus message" -DeleteContent
    

    This example first gets all the mailboxes on database DB1, searches for items that contain the string "Virus message" in the subject, and deletes those items.

  • To export data from all the mailboxes of users in the Marketing organizational unit, run the following command:

    Get-Mailbox -OrganizationalUnit Marketing | Export-Mailbox -PSTFolderPath C:\PSTFiles
    

    This example exports the data from each mailbox to a separate .pst file located at C:\PSTFiles. The name of each .pst file will be <alias>.pst.

For detailed syntax and parameter information, see the Export-Mailbox reference topic.

Exchange 2007 RTM

To use the Exchange Management Shell to export mailbox data in Exchange 2007 RTM

  • To export the special folders and empty folders of the mailbox to a folder in the destination mailbox, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -TargetMailbox ExportMailbox -TargetFolder <Folder_Name>
    
  • To export data from a group of mailboxes, such as all mailboxes for which the user title begins with "VP," run the following command:

    Get-User | where { $_.Title -ilike "VP*" } | Export-Mailbox -TargetFolder <Folder_Name> -TargetMailbox <MailboxIdParameter>
    
  • To export data received between specific dates, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -StartDate "<Month/Day/Year>" -EndDate "<Month/Day/Year>" -TargetFolder <Folder_Name> -TargetMailbox <MailboxIdParameter>
    
  • To export only data from the Sent Items folder, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -IncludeFolders '\Sent Items' -TargetFolder <Target_Folder_Name> -TargetMailbox <MailboxIdParameter>
    
  • To exclude folders from the export, such as excluding items in the Junk E-Mail and Contacts folders, run the following command:

    Export-Mailbox -TargetMailbox <MailboxIdParameter> -TargetFolder <Target_Folder_Name> -ExcludeFolders "\Junk E-Mail","\Contacts"
    
  • To use filters to specify which items in the source mailbox to include in the export, run the following command:

    Export-Mailbox -Identity <MailboxIdParameter> -TargetMailbox <MailboxIdParameter> -TargetFolder <Target_Folder_Name> -ContentKeywords "<String[]>" -AttachmentFilenames "<String[]>" -StartDate "<Month/Day/Year> <Time>"
    
  • To find and delete items from a group of mailboxes, such as all mailboxes on a database, run the following command:

    Get-Mailbox -Database DB1 | Export-Mailbox -TargetMailbox ExportMailbox -TargetFolder VirusData -SubjectKeywords "Virus message" -DeleteContent
    

    This example first gets all the mailboxes on database DB1 and then searches for items that contain the string "Virus message" in the subject. It will export the items to the mailbox ExportMailbox and will delete those items from the source mailbox.

For detailed syntax and parameter information, see the Export-Mailbox (RTM) reference topic.

Replacing ExMerge.exe

In Exchange 2003 or Exchange 2000, you can use the Microsoft Exchange Server Mailbox Merge wizard (ExMerge.exe) to export mailbox data. The following table lists scenarios for using ExMerge.exe in Exchange 2003 or Exchange 2000, and the solution for performing this task in Exchange 2007.

Scenario in Exchange 2003 and Exchange 2000 Exchange 2003 and Exchange 2000 resources Exchange 2007 solution

Use ExMerge.exe in Exchange 2003 or Exchange 2000 in recovery scenarios to move the recovered data from the recovery storage group to another database.

To perform this task in Exchange 2007, use the Restore-Mailbox cmdlet. For more information, see How to Recover a Mailbox by Using a Recovery Storage Group.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 to export user data from a corrupted database to a .pst file, and then from the .pst file to a new database.

For information about the Exchange 2003 or Exchange 2000 scenario, see Microsoft Knowledge Base article 313184, How to recover the information store on Exchange 2000 Server or Exchange Server 2003 in a single site.

To perform this task in Exchange 2007, use the Restore-Mailbox cmdlet to restore the data from backup, and then use the Move-Mailbox cmdlet. For more information, see Restore-Mailbox and Move-Mailbox.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 to move mailboxes to a different server.

For information about the Exchange 2003 or Exchange 2000 scenario, see Microsoft Knowledge Base article 328810, Moving mailboxes between servers.

To perform this task in Exchange 2007, use either the Move Mailbox wizard or the Move-Mailbox cmdlet. For more information, see How to Move a Mailbox Within a Single Forest or How to Move a Mailbox Across Forests.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 to remove a specific message that was sent to users in your Exchange organization. For example, you may want to delete a virus message or a confidential message that was sent inadvertently.

For more information about the Exchange 2003 or Exchange 2000 scenario, see Microsoft Knowledge Base article 328202, HOW TO: Remove a Virus-Infected Message from Mailboxes by Using the ExMerge.exe Tool.

To perform this task in Exchange 2007, use the Export-Mailbox cmdlet with the DeleteContent parameter and any of the content filtering parameters, such as AllContentKeywords, AttachmentFilenames, ContentKeywords, SubjectKeywords, StartDate, or EndDate. For more information, see Export-Mailbox.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 to find a specific message that was sent to users in your Exchange organization, or to find all messages with specific words in the subject, message body, or attachments.

For more information about the Exchange 2003 or Exchange 2000 scenario, see Microsoft Knowledge Base article 246916, XADM: How to Find Mailboxes That Contain a Specific Message.

To perform this task in Exchange 2007, use the Export-Mailbox cmdlet with any of the content filtering parameters, such as AllContentKeywords, AttachmentFilenames, ContentKeywords, SubjectKeywords, StartDate, or EndDate, but without the DeleteContent parameter. For more information, see Export-Mailbox.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 as an alternative way to restore mailbox data if you have problems during a mailbox move.

None

To perform this task in Exchange 2007, use the Restore-Mailbox cmdlet to restore mailbox data, and use the Move-Mailbox cmdlet to move mailboxes. For more information, see Restore-Mailbox and Move-Mailbox.

Use ExMerge.exe in Exchange 2003 or Exchange 2000 to export data to a .pst file. For example, if you are in a hosting scenario, you may want to send mailbox content to a former user in the organization.

None

To perform this task in Exchange 2007 SP1, use the PSTFolderPath parameter.

To perform this task in Exchange 2007 RTM, you have two options:

  • Log on to the mailbox that is running Microsoft Outlook, and then use Outlook to export the data to a .pst file.

  • Use the Export-Mailbox cmdlet to export the data from several mailboxes to a single, separate mailbox, and then log on to that mailbox and use Outlook to export the data to a .pst file. For more information about this scenario, see the Exchange Server Team Blog article Exchange Server 2007 Export Mailbox task.

    Note

    The content of each blog and its URL are subject to change without notice. The content within each blog is provided "AS IS" with no warranties, and confers no rights. Use of included script samples or code is subject to the terms specified in the Microsoft Terms of Use.

For More Information

For more information about importing mailbox data from a .pst file, see How to Import Mailbox Data.