In the event that a large organization is migrating to Office 365, it can be tedious to export mailboxes one by one. The following steps make it quick and simple to export all mailboxes at once, using only a few commands. For visuals of these steps, please reference the attached file. 


Step1: Log into Exchange Server 


Step 2: You have to acquire import export roles on the profile you are logged in with. To do this, run the following command in the Exchange Management Shell:

c:\>New-ManagementRoleAssignment –Role “Mailbox Import Export” –User Administrator

 

Step 3: Close Exchange Management Shell 


Step 4: Open File Explorer and create a Shared Folder. This is where you will export the user Mailboxes to. 


Step 5: Re-open Exchange Management Shell and run the following command (replace the file path with the location of the shared file you created):

c:\>foreach ($i in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\mail10\PST\$($i.Alias).pst" }

 

Step 6: Navigate to the shared folder you created and verify that the PST files are beginning to populate. Depending on the amount of mailboxes you are exporting, it can take some time for the export to finish completely. 

You can check the status of the exports using the following command: 

c:\>Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

 

Step 7: Once all mailboxes have been exported successfully, you'll need to remove the export request. To do this, run the following command:

c:\>Get-MailboxExportRequest | Remove-MailboxExportRequest

It will ask you to confirm. Type "A" for "Yes to all"