With Exchange Server 2010 the option to use exmerge is history. Too bad because it was such a usefull tool to really quick make an export of an users mailbox. But no fear with SP1 and SP2 you can do this from the powershell command line, you’ll have to set some requirements but you’ll be exporting mailboxes before you know it.
Requirements:
- Microsoft.Exchange.Management.PowerShell.E2010 Snapin
- Mailbox Import Export Role
- Networkshare for PST files
Check and/or add Exchange 2010 Snapin
1. First check if the Exchange Server 2010 Snapin is installed in your Managemet Shell.
Get-PSSnapin
2. If it’s not on the list you can check if the required Snapin is registered. It should be listed now.
Get-PSSnapin - registered
3. To install the required Snapin execute:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
The import export cmdlets are now available for use.
Mailbox Import Export Role
The Mailbox Export Import Role is not set, so no accounts are granted the rights to export mailboxes by default. You will need to explicity grant these rights, so also to the Administrator account.
Run the following command to create a new RoleGroupName with the correct Role, member(s) and a nice description.
New-RoleGroup -Name "Exchange Mailbox Import Export" -Roles "Mailbox Import Export" -Members "<domain>\administrator" -DisplayName "Exchange Mailbox Import Export" -Description "This group handles permissions to the import and export commands in Powershell."
Now you’re account will be granted access to the Exchange Mailbox Import Export command.
Networkshare for PST files
The last requirement is to create a network share to save your .pst files. The reason you want this on a network share is because the mailbox export request is processed by the CAS Server, when you have multiple CAS Servers it should be accessible by all servers.
The only requirement is that the Exchange Trusted Subsystem group has read/write permissions.
Export Mailbox commands
At this point everything is set to make a succesfull Export of your mailboxes.
Export a Mailbox
New-MailboxExportRequest -Mailbox "Administrator" -FilePath \\Server\PST$\administrator.pst
Export an Archive Mailbox
New-MailBoxExportRequest -Mailbox "Administrator" -FilePath \\Server\PST$\Administrator_archive.pst -IsArchive
Export Request Status
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics
Remove MailboxExportRequest
After the Export is completed it remains on the server until it is removed using the Remove-MailboxExportRequest command.
Get a list of completed Mailbox Exports
Get-MailboxExportRequest -Status Completed
Clear the list of completed Mailbox Exports
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
Interactive Mailbox export
If you would like to make this pst-export more interactive the one-liner can be changed to a small powershell script. The script ask you for the username and exports it to a username.pst file.
$user = read-host "Please enter the Username:" $share = "\\Server\Networkshare" New-MailBoxExportRequest -Mailbox "$user" -FilePath $share\$user.pst
It’s also possible to export all mailboxes to .pst files, you can read that in my blogpost: Exchange Server 2010 export all mailboxes with powershell
Thank you for the above help. I need one more thing from you. How would i
1 – make a script so it can prompt me for the user name
2 – and then using that user name to name the pst file. (i.e john.pst)
Thanks again for your help. John
John, this also crossed my mind and with a tip from Handige Knakker (http://www.handigeknakker.nl) it’s now interactive!
The post is updated with the interactive script.
Hi Martin –
OMG, you rock!!!. It worked beautifully, thanks so much for the quick reply and the awesome script. You have a new follower.
thanks again Martin.
Hi Martin,
My exchange 2010 version is 14.0.639.21
I tried from your instruction but “Get-MailboxExportRequest” is not show up.
Not sure my version is support for this command or not.
Thx
Kongsit
Hi Kongsit,
You should at least have Exchange 2010 SP1 (or SP2) before you can use this command.
Great article – so useful!
Quick question, I would like to backup all user mailboxes on say a monthly basis. How can your commands be adapted to allow for a scheduled task to run as Administrator and export all mailboxes to a PST, and then clear the completed list of export requests?
Thanks, Lee.
Lee, check out my new blogpost “Exchange Server 2010 export all mailboxes with powershell” , that should do it!
Cheers!
Hi Martin,
Was looking for the export mailbox and prompt for username on http://www.handigeknakker.nl/?x=entry:entry100804-150342
Didn’t see it posted, I see general command to export based in inputting username right from command line.
Great script.
Somehow mine is queued forever.