How to Export Microsoft 365 (Exchange Online) Mailbox to PST using PowerShell?

To export a Microsoft 365 (Exchange Online) mailbox to PST using PowerShell, follow these steps:

  1. Open the PowerShell command prompt with administrator privileges.
  2. Connect to your Microsoft 365 Exchange Online account using the following command: $credential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection Import-PSSession $Session -DisableNameChecking This will prompt you for your Microsoft 365 account credentials and establish a remote PowerShell session to your Exchange Online account.
  3. Once connected, create a new folder on your local computer where you want to save the PST file.
  4. Run the following command to export the mailbox to a PST file: New-MailboxExportRequest -Mailbox <MailboxName> -FilePath "<Path>\ExportedMailbox.pst" Replace <MailboxName> with the name of the mailbox you want to export and <Path> with the path to the folder you created in step 3.
  5. Monitor the export request status using the following command: Get-MailboxExportRequest -Mailbox <MailboxName> | Get-MailboxExportRequestStatistics This will show you the status of the export request and the progress of the export.
  6. Once the export is complete, you can remove the export request using the following command: Get-MailboxExportRequest -Mailbox <MailboxName> | Remove-MailboxExportRequest This will remove the export request and free up any resources used by the export process.

Note: You may need to adjust your Microsoft 365 account permissions or PowerShell execution policy to perform mailbox exports.