PowerShell - Export 365 Mailbox to .PST

Export 365 Mailbox to .PST


1. Using powershell, establish a connection to the Microsoft Exchange Servers
  • Import-Module MSOnline
  • $ocred = Get-Credential [enter the exch_admin@ACME.com credentials in the pop-up window]
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $ocred -Authentication Basic -AllowRedirection
  • Import-PSSession $Session

2. Using powershell, grant access to the mailbox you wish to export
  • Add-MailboxPermission -User mtr1@ACME.com -Identity mt-old-account@maytechgroup.com -AccessRights FullAccess -InheritanceType all

3. Open Outlook as Account@ACME.com and make sure the old-account@ACME.com mailbox shows up in your list of mailboxes on the left-hand side. If it doesn't, then you may need to wait a few minutes for the permissions to take affect. You can also try configuring your account to open that mailbox, but this should not be necessary.  

4. Make sure Outlook is configured to download all mail instead of only caching mail for a limited period of time. Click the "File" menu in the upper-left corner, and on the Info page, click the "Account Settings" button and select "Account Settings..." from the menu. Select your account from the list and click the "Change..." button. Make sure the Offline Settings have "Use Cached Exchange Mode" checked and the "Mail to keep offline:" slider set to "All". You may need to close and reopen Outlook for this to take affect. 


5. After Outlook shows "All Folders Up To Date" in the bottom, right-hand corner, use the Import/Export wizard to export the mt-old-account mailbox to a PST file.
  • Click the "File" menu in the upper-left corner
  • Click "Open & Export" in the left-hand menu and then click "Import/Export" 
  • Select "Export to a file" from the list of actions to perform and click "Next" 
  • Select "Outlook data file (.pst)" from the list of file types and click "Next" 
  • Select "mt-old-account" in the list of folders to export from and click "Next". Make sure the "Include subfolders" box is checked. 
  • Specify the file name and path where you want to save the pst to - i.e. c:\tmp\outlook-archive-old-account-20150210.pst. In the options box, select either "Do not export duplicate items" or "Replace duplicates with items exported" (this should be the default). Click "Finish" to complete the process. 
  • When prompted to specify a password for the .pst file, enter an appropriate password if that is required or leave those fields blank if policy allows and click "OK". 
  • Outlook will be unusable during the export process. Wait for Outlook to stop showing the progress of the export and give you back control and the process is complete. 
6. To verify the export completed successfully, check the mailbox size on the server, and compare it to the file size of the .pst you exported. 
  • Right-click the mailbox in the left-hand menu, and select "Data file properties..." 
  • On the "General" tab, click the "Folder Size..." button 
  • In the "Folder Size" window, click the "Server Data" tab and make note of the value for "Total size (including subfolders):" 
  • Check the file properties of the exported .pst file and make sure the size is similar to the "Total size" value reported by Outlook. It is common for the .pst file to have a file size that is up to 10% larger.
7. After the export is complete, remove the permissions you assigned earlier using PowerShell
  • Remove-MailboxPermission -User account@acme.com -Identity old-account@acme.com -AccessRights FullAccess
8. Close the PowerShell session with Office 365
  • Remove-PSSession $Session