Interactive PowerShell script to enable and configure the In-Place Archive on Exchange Online, set a retention policy and immediately trigger archiving, no manual cmdlets needed.
- PowerShell 5.1 or later
ExchangeOnlineManagementmodule installed- Minimum roles: Mail Recipients + Retention Management
If the module is missing, the script detects it and shows the install command:
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser.\ITA_Enable-ExArchive.ps1Or
.\ENG_Enable-ExArchive.ps1Fully interactive, no parameters required.
[1] Checks that the ExchangeOnlineManagement module is installed
[2] Opens Microsoft OAuth2 login (browser popup)
[3] Enables Auto-Expanding Archive at organization level
[4] Asks for the target user (UPN or display name)
[5] Lets you choose the archiving threshold
[6] Shows a full summary and asks for confirmation before proceeding
[7] Executes all required operations
[8] Verifies the final state and disconnects
- Enables the In-Place Archive on the mailbox (if not already active)
- Enables Auto-Expanding Archive on the mailbox
- Creates the
MoveToArchiveRetention Tag with the chosen threshold - Creates the Retention Policy and links the tag
- Assigns the policy to the mailbox
- Remove the retention hold flag from the mailbox
- Forces an immediate run of the Managed Folder Assistant
Note: If a Retention Tag or Policy already exists in the tenant it is reused, not duplicated. At most 6 fixed policies will exist in the tenant (one per threshold), shared across all mailboxes configured with the same threshold.
| Choice | Threshold | Days |
|---|---|---|
1 |
1 year | 365 |
2 |
2 years | 730 |
3 |
3 years | 1095 |
4 |
4 years | 1460 |
5 |
5 years | 1825 |
6 |
6 years | 2190 |
7 |
Custom | years × 365 |
Option 7 accepts any integer from 1 to 99 years and calculates the days automatically.
| License | In-Place Archive | Primary Mailbox | Archive (base) | Native Auto-Expanding | With Add-on |
|---|---|---|---|---|---|
| Exchange Online Plan 1 | ✅ | 50 GB | 50 GB | ❌ | ✅ up to 1.5 TB |
| Exchange Online Plan 2 | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
| M365 Business Basic | ✅ | 50 GB | 50 GB | ❌ | ✅ up to 1.5 TB |
| M365 Business Standard | ✅ | 50 GB | 50 GB | ❌ | ✅ up to 1.5 TB |
| M365 Business Premium | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
| M365 E1 | ✅ | 50 GB | 50 GB | ❌ | ✅ up to 1.5 TB |
| M365 E3 | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
| M365 E5 | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
| Office 365 E1 | ✅ | 50 GB | 50 GB | ❌ | ✅ up to 1.5 TB |
| Office 365 E3 | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
| Office 365 E5 | ✅ | 100 GB | 100 GB → 1.5 TB | ✅ | — |
Add-on: Exchange Online Archiving for Exchange Online (~$3.00/user/month)
Auto-expanding archive: starts at 100 GB and grows automatically up to ~1.5 TB per mailbox.
Plans marked with ✅ under Native Auto-Expanding already include the add-on functionality — no extra license needed.
📄 Source: Exchange Online Archiving service description – Microsoft Learn
After running the script, the Managed Folder Assistant works in the background. To monitor progress:
Primary mailbox item count — if it drops, archiving is working:
Get-MailboxStatistics user@domain.com | fl ItemCount,TotalItemSizeArchive contents — non-empty folders only (recommended):
Get-MailboxFolderStatistics user@domain.com -Archive | where {$_.ItemsInFolder -gt 0} | ft Name,ItemsInFolder,FolderSizeArchive contents — all folders:
Get-MailboxFolderStatistics user@domain.com -Archive | ft Name,ItemsInFolder,FolderSize| Scenario | Expected time |
|---|---|
| First run, standard mailbox | 1–6 hours |
| Large mailboxes (50 GB+) | up to 24 hours |
| Subsequent runs | automatic Microsoft cycles |
The process is entirely server-side Outlook or OWA do not need to be open.
- Archiving is one-way mail moved to the archive does not return to the inbox if the policy is changed
- Changing the threshold on an already configured mailbox only affects future archiving; mail already archived remains untouched
- There is no visible MRM queue the Managed Folder Assistant runs in silent batches