Tuesday, April 22, 2008

Export-Mailbox from PowerShell

There are many times, either when restoring a mailbox or creating a permanent copy of a former employee's mailbox, when I have needed to be able to easily copy the entire contents of the mailbox. The best way I have found to do this is with the export-mailbox cmdlet using the Powershell. There are two requirements for this command:
  1. Must be run on a 32-bit machine
  2. Must have Outlook installed
The parameters for this command depend on what format you are exporting the mailbox to. You can export it to another user's mailbox. The syntax for this process is:

export-mailbox -identity mailbox.name -targetmailbox target.mailbox -targetfolder targetfoldername


This will place a complete copy of the exported mailbox into the target mailbox in a folder that is specified in the -targetfolder switch.

The other option for this command is to export the mailbox to a PST. The interesting thing about this option is that I haven't been able to get it to work. The switch is not part of the cmdlet on my workstation, but is available on the Exchange server. The Exchange server is 64-bit and doesn't have Outlook installed, so it can't be run from that machine. The syntax for this command would be:

export-mailbox -identity mailbox.name -PSTFolderPath foldername


This will export the contents of the mailbox to a PST file and place it in the folder that is specified by the -PSTFolderPath switch.

No comments: