Cry Exchange 2010 How To...


How to export a mailbox to a pst file (export emails from exchange)

Exchange Management Shell can be used to export a mailbox to a pst file using the New-MailboxExportRequest cmdlet:

  1. Log onto the Exchange server and start up Exchange Management Shell.
  2. Enter the command:

    New-MailboxExportRequest -mailbox MailboxID -filePath uncFileName

    Substituting the account name for "MailboxID" and a UNC file path for "uncFileName" (for example \\myserver\share\file.pst or \\localhost\c$\folder\file.pst).

That should be it - just be aware that the command might return straight away but that doesn't mean it has finished (see "How do you know when the export has finished", below).

There are other parameters that can be used (for example to restrict which folders are exported), for the full list see https://technet.microsoft.com/en-us/library/ff607299%28v=exchg.141%29.aspx.

Except ... if you get the error:

New-MailboxExportRequest: The term 'New-MailboxExportRequest' is not recognised as the name of a cmdlet, function, script file, or operating program. ...

Then this indicates that either:

  • You are running on a version of exchange prior to Exchange 2010 sp1. If you are using Exchange 2010 then check that you have sp 1 or later installed. If you are using an earlier version of exchange then sorry but New-MailboxExportRequest is not supported.
  • you are not a member of the "Mailbox Import Export" role. Once you are a member of this role the cmdlet will be recognized. To grant yourself membership of this role use:

    New-ManagementRoleAssignment -role "Mailbox Import Export" -user domain\user-id

    substituting your domain name and user-id in the above. Once you have done that you will need to close the exchange management shell, open a new one and try again.

How do you know when the export has finished?

The above will queue the export, and in my experience the export starts almost straight away. But how to know when it has finished?

The cmdlet Get-MailboxExportRequest will let you see all exports that have been requested.

So

Get-MailboxExportRequest

will list all exports - including those that were done ages ago.

Get-MailboxExportRequest -Status InProgress

will list those exports that are currently in progress.

Get-MailboxExportRequest | where {$_.status -ne "Completed"}

will list all exports that are not completed - this will include any exports in progress or which have not yet started.

Should you wish to clear all completed requests then use:

Get-MailboxExportRequest -status Completed | Remove-MailboxExportRequest


These notes have been tested with Exchange Server 2010.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.