In Microsoft 365, exporting only the In-Place Archive mailbox to PST isn't straightforward.
While the normal Content Search in Microsoft Purview includes both the primary and archive mailboxes, there's no direct option to select the archive mailbox alone.
To solve this, I wrote a PowerShell script that helps you create a targeted Compliance Search for all folders inside the archive mailbox allowing you to export only archive data later via the Purview portal .
What the Script Does
This PowerShell script:
Connects to Exchange Online and Microsoft Purview (Compliance Center)
Retrieves all folder IDs from the specified mailbox's In-Place Archive
Builds a combined ContentMatchQuery for those folders
Creates and optionally starts a Compliance Search for archive-only content
Allows you to later export and download the search results as a PST file via Purview Portal
Prerequisites
To run this script successfully, make sure:
In Exchange Online
You have the Exchange Administrator role.
This role provides the required access to connect to Exchange Online PowerShell and retrieve mailbox folder statistics.
In Microsoft Purview
You must have permissions to:
(These are typically included in the eDiscovery Manager or Compliance Administrator roles.)
PowerShell Modules Required
Make sure these modules are installed and updated:
Install-Module ExchangeOnlineManagement -Force
Import-Module ExchangeOnlineManagement
You'll also need the Security & Compliance PowerShell module for connecting to Purview:
Connect-IPPSSession
Execution Workflow
Download the Script
Launch PowerShell and Run the Script
Open Windows PowerShell (Run as Administrator).
Navigate to the folder where the script is saved.
cd "C:\Path\To\Script"
Execute the script:
.\In-PlaceArchiveDownload.ps1
Connect to Exchange Online PowerShell
Retrieve Mailbox Folder Details
Create a Compliance Search
Connect to Microsoft Purview (Compliance Center)
Start the Compliance Search
Export and Download PST from Purview
Open the Microsoft Purview Portal ā navigate to Content Search .
Locate the Compliance Search name you created.
Select Export Results ā PST format .
Once the export completes, download the PST file directly from the portal.
Benefits of Using This Automation
ā
Automates a manual multi-step process
ā
Integrates seamlessly with Purview eDiscovery
ā
Saves administrative time and effort
š Conclusion
Exporting data from In-Place Archive mailboxes in Microsoft 365 has always been a tedious and partially manual process.
This PowerShell automation provides a reliable and repeatable way to:
Collect all archive folder IDs
Build a comprehensive search query
Create and start a Compliance Search
Export results as a PST file through Microsoft Purview
With the right permissions and setup, this script can significantly simplify archive mailbox export tasks for Exchange Online administrators.