Exporting Exchange Mailboxes Using Powershell
So we’re doing a mail migration and I want to export the source mailboxes just in case things go awry. We’re using the Quest Exchange Migration manager tool and it’s a magic piece of software – having said that I want the mailboxes backed up in PST format in case a user says a message is missing.
On Exchange 2007 and newer the old Exmerge software is no longer available. It’s been replaced by the powershell commandlet export-mailbox.
Using the command is the easy bit, getting the software in place is the hard bit. For starters you need to run this commandlet of a 32 bit machine. You need the Exchange Management Tools installed on there which in turn relies on IIS. The tools also depend on a local Outlook installation to do all the MAPI work in exporting a mailbox to PST.
Once you’ve got all the above installed the export process is really simple. Using the command below:
Get-Mailbox -Server <server> -sortby Alias | export-mailbox –PSTFolderPath <pstpath>
Breaking the above command down, first we’re getting all the mailboxes on a given server and sorting them by alias. We then pipe the mailboxes to the export-mailbox commandlet which, as the name implies exports the mailbox to a PST file.
There’s a lot of options to the export-mailbox commandlet and the above does the basic export the entire mailbox. It’s possible to do a lot more including exporting messages based on timestamps and content.