Exporting & Importing bulk mailboxes in Exchange 2010

I have been wanting to write this post for a while now but laziness got the better off me on all the previous occasions but not anymore!

So the purpose this post is to highlight how we can export bulk user mailboxes to a pst file. In earlier versions of Exchange (i.e Exchange 2003 and earlier) we had our good old friend "Exmerge" and it was relatively simple to use while applying just a little common sense! but now in the days of Exchange 2010 and beyond Microsoft wants us to use "PowerShell" and act all smart. So I am going to show you how to export bulk mailboxes from a particular exchange database and then import the pst files back to all the users in that database.

 In order to use the "New-MailboxExportRequest" cmdlet you need to first assign the "Mailbox Import Export" role to the user account performing the action

Example: New-ManagementRoleAssignment -Role "Mailbox Import Export" -User domain\username

Close and then Re-Open the Exchange Management Shell for the changes to take effect.

====================================

Export User Mailboxes to PST

 Then we need to capture all the users from the target database into a variable and so use the below command.

C:\> $mailboxes = Get-Mailbox -Database Managers

C:\> $mailboxes | %{$_|New-MailboxExportRequest -FilePath \\server1\c$\pst\$($_.alias).pst}

The above command once completed will export all the user mailboxes from the database called "Managers" to the location on the selected server in a folder called PST.

You can check the status by running the command 

Get-MailboxExportRequest

================================

Import PST's back to User Mailboxes

C:\> $mailboxes | %{$_|New-MailboxImportRequest -FilePath \\server1\c$\pst\$($_.alias).pst -TargetFolder "RecoveredFiles"}

You can check the status by running the command

Get-MailboxImportRequest

================================

 -Alstar