Networknet archive Blog

Exchange 2007: Export a mailbox with the Management Shell

Originally published Last updated 2 comments

Exchange Server 2007 Service Pack 1 (SP1) added the Export-Mailbox cmdlet to the Exchange Management Shell.

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.

To export data to a .PST file, run Export-Mailbox on a 32-bit computer with the 32-bit Exchange management tools and either Outlook 2003 Service Pack 2 (SP2) or Outlook 2007 installed.

With the prerequisites in place, I opened the Exchange Management Shell and ran this command:

C:\Documents and Settings\admin>Export-Mailbox -identity user1 -PSTFolderPath c:\user1.pst
Are you sure you want to perform this action?
Exporting mailbox content from the mailbox 'Ivan Versluis' into .pst file 'c:\Ivan.pst'. This operation may take a long time to
complete.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
Export-Mailbox : Error was found for 'Ivan Versluis' (user1(at)networknet.nl) because: Error occurred in the step: Moving messages. Failed to copy messages to the destination mailbox store with error:
MAPI or an unspecified service provider.
ID no: 00000000-0000-00000000, error code: -1056749164
At line:1 char:15
+ Export-Mailbox <<<<  -identity 'Ivan Versluis' -PSTFolderPath c:\Ivan.pst
    + CategoryInfo          : InvalidOperation: (0:Int32) [Export-Mailbox], RecipientTaskException
    + FullyQualifiedErrorId : DFCFF30D,Microsoft.Exchange.Management.RecipientTasks.ExportMailbox

The export failed. After reading several posts I found through Google, I tried exporting my own mailbox, which worked. I concluded that the problem was related to permissions. Use Add-MailboxPermission to grant full access before exporting the mailbox.

Grant access and export the mailbox

PowerShell1 line
1
Add-MailboxPermission -identity user1 -Accessrights FULLACCESS -User admin
PowerShell1 line
1
Export-Mailbox -identity user1 -PSTFolderPath c:\user1.pst

With these steps, I can develop a procedure to back up mailboxes when they are removed from the system.

2 comments

Comments from the original WordPress site, kept read-only.

  1. Kobina

    Ivan,

    I had been searching a while for a solution and then I saw yours.
    It worked like a charm. Much appreciated.