Skip to main content
Skip table of contents

Export of Mailboxes from Exchange 2010 Using the cmdlets PowerShell

Microsoft® Exchange 2010™ SP1 permits the export of user mailboxes with the New-MailboxExportRequest cmdlet. This command will create an Outlook PST file containing the user’s mailbox including contacts, calendar records, etc. Thanks to the capabilities of the Exchange PowerShell, you can also use Exchange command-lets for exporting or importing PST files for a huge list of users.

The cmdlets New-MailboxExportRequest and New-ImportMailboxRequest can only be used by a user to whose account the Mailbox Import Export role was assigned. In Exchange 2010, these commands are hidden by default. Furthermore, Outlook 2010 (64-bit) must be installed on the Exchange 2010 Mailbox server to carry out the export.

The PowerShell commands available to export or import PST files vary in the different versions of Microsoft Exchange. The commands differ between Microsoft Exchange 2007, Exchange 2010 and Exchange 2010 SP1. This document explains the export of mailboxes from Microsoft Exchange only for Exchange 2010 SP1.

Required permissions for using export/import cmdlets

Users who are members of the Microsoft Exchange Security Group Organization Management are permitted to assign the Mailbox Import Export role to other users.

Use the following PowerShell command to assign the Mailbox Import Export role to an individual user:
New-ManagementRoleAssignment -Role Mailbox Import Export -User UserAlias

If you want to assign the Mailbox Import Export role to a Security group, use the following command:
New-ManagementRoleAssignment -Role Mailbox Import Export -SecurityGroup NameofGroup

This security group cannot be a local or global security group. It must be a universal security group.

In addition to having been assigned the Mailbox Import Export role, all users who will use the Export- or Import-Mailbox commands should also be a member of the local Administrators group on the Exchange server.

Preparing the server environment for expporting Exchange mailboxes to PST Files

  • Install Outlook 2010 64-bit on the Exchange 2010 mailbox server.

  • Create a folder on the hard drive where mailboxes will be exported. For example, you could create one as follows:
    C:\UserPST

When selecting the location for this folder, you should ensure that sufficient drive space is available for storing the mailbox data that you want to export.

  • Share the folder you created so that it can be accessed via UNC addressing, e.g.✔️ \\server_name\UserPst

Ensure that the necessary Exchange, share, and file permissions are assigned to the user account that is performing the activity.

Cmdlets available for exporting mailboxes from the Exchange datastore

Exporting an individual mailbox

  • Start the Exchange PowerShell.

  • Use the following PowerShell command to export user A’s mailbox (alias: user.A) to the folder that has been created for this purpose, e.g.:
    \\server\UserPST

You have to supply a file name for the PST file.
New-MailboxExportRequest -Mailbox user.A -FilePath \\server\UserPST\user.A.pst

Exporting all mailboxes from an Exchange database

  • Start the Exchange PowerShell.

  • Use the following PowerShell command to export all the mailboxes from a mailbox database. In this example, the database from which to export the mailboxes is called databaseName.
    Get-Mailbox -Database " databaseName " -ResultSize Unlimited | Export-Mailbox -PstFolderPath C:\UserPST

Exporting all the mailboxes from a server (Servername)

  • Start the Exchange PowerShell.

  • Use the following PowerShell command to export all of the mailboxes from a specific server. In this example, the server from which to export the mailboxes is called serverName.
    foreach ($i in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $i -Name $i.Alias -FilePath "\\ serverName \ExportPST\$($i.Alias).pst" }

Export requests for all users are created with the mail user’s alias as the export request name. This is done because the request statuses can be more easily monitored with the Get-ExportMailboxRequest cmdlet.

Exporting all mailboxes of a specific organizational unit

  • Start the Exchange PowerShell.

  • Use the following PowerShell to export all the mailboxes from all the Exchange servers and databases in the myOrganization Exchange organization of the myDomain.tld domain:
    foreach ($i in (Get-Mailbox -OrganizationalUnit "ou=myOrganization,dc=myDomain,dc=tld" -resultsize unlimited)) { New-MailboxExportRequest -Mailbox $i -Name $i.Alias -FilePath "\\ serverName \ExportPST\$($i.Alias).pst" }

This command results in the Get-Mailbox cmdlet filtering the mailboxes. It will list and therefore only export mailboxes that belong to the specified organizational unit. You can also filter the mailboxes to be listed, e.g., by server or database. For more information, please see the documentation for the Get-Mailbox cmdlet.

Known Issues

Error approving object

In some scenarios, the export might not work if the CAS role is installed together with the mailbox role on the same server. A bug has been identified for this issue. In such situations, the Export-Mailbox and Import-Mailbox commands may not work. You may have to export the PSTs from client machines.

The following error appears when trying to run the Export-Mailbox command in such situations:
StatusCode : -2147221219 StatusMessage : Error occurred in the step: Approving object. An unknown error has occurred.

In such scenarios, you can use Outlook 2010 to export user mailboxes to a PST file. Alternatively, you can split up your infrastructure in such a way that the CAS server role and the Mailbox server role are assigned to different servers.

Permission problems

You may receive error messages denying access or claiming insufficient privileges. This can be due to the fact that you are using the default administrator account for completing this task. It is preferable to use a different user account with administrative privileges because there may be restrictions in Exchange on the default administrator account.

Public folders

Microsoft does not supply any cmdlets or explicit tools for exporting public folders directly from the Exchange server. In order to export public folders to PST files, you have to either use the Microsoft Outlook email client or a third party tool.

Resources

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.