Managing, Restoring & Recovering Inactive Mailboxes in Exchange Online with Microsoft Purview Retention Holds (PowerShell Runbook)

🤖 AI Executive Brief & Inactive Mailbox Rules Exchange Online · Microsoft Purview Data Lifecycle
How Inactive Mailboxes Save Licensing Costs Without Losing Compliance Data
  • Zero ongoing license cost: Once a mailbox is placed on **Purview Retention Policy**, **Retention Label**, **eDiscovery Hold**, or **Litigation Hold** and the user's Entra ID account is deleted, the mailbox becomes an **Inactive Mailbox**. You can immediately reassign the user's Microsoft 365 E3/E5 license to a new hire.
  • Recover vs. Restore: Use `New-Mailbox -InactiveMailbox` (or `Undo-SoftDeletedMailbox`) to convert an inactive mailbox back into a live mailbox for a rehired employee. Use `New-MailboxRestoreRequest` to merge an inactive mailbox's contents into a manager's or replacement employee's active mailbox.
  • Verify Hold before deleting the Entra user: If you delete a user whose mailbox has NO hold applied, it becomes a normal soft-deleted mailbox and is **permanently purged after 30 days**.
Get-EXOMailbox -InactiveMailboxOnly -PropertySets Hold | Select DisplayName, ExchangeGuid, LitigationHoldEnabled, InPlaceHolds

When an employee leaves the organization, deleting their Microsoft Entra ID (formerly Azure AD) account normally soft-deletes their Exchange Online mailbox for 30 days, after which the mailbox is permanently purged.

However, enterprise compliance, legal discovery, and regulatory mandates often require preserving former employees' email and Teams messages for 3 to 10 years—without paying for hundreds of unused Microsoft 365 licenses.

Inactive Mailboxes in Exchange Online solve this: by applying a Microsoft Purview retention policy, eDiscovery hold, or Litigation Hold before deleting the user account, Exchange Online preserves the mailbox indefinitely (or for the duration of the retention policy) at zero ongoing license cost.

This runbook covers the entire inactive mailbox lifecycle in PowerShell: pre-deletion hold verification, auditing inactive mailboxes, recovering a mailbox for a rehire, merging contents into another mailbox, and permanently releasing an inactive mailbox.


Exchange Online Inactive Mailbox Lifecycle & Recovery Paths 1. Pre-Offboarding Exchange Online Plan 2 / E3 / E5 license active Verify Purview Retention or LitigationHoldEnabled Wait 60m after new hold 2. Delete Entra User Delete user in Entra ID or move out of Sync OU Mailbox transitions to IsInactiveMailbox = True License freed immediately 3A. Restore (Merge) New-MailboxRestoreRequest -SourceMailbox <Guid> Copies mail into target folder in manager mailbox Inactive copy stays intact 3B. Recover (Rehire) New-Mailbox -InactiveMailbox <Guid> Converts inactive store back into active mailbox Assign license within 30d Always reference Inactive Mailboxes by their ExchangeGuid or DistinguishedName to avoid UPN collisions.

1. Pre-Offboarding Verification: Confirm Hold Is Stamp-Confirmed

Before deleting a departing employee's user account, always verify that either LitigationHoldEnabled is $true or a Purview retention policy GUID is present in InPlaceHolds (or ComplianceTagHoldApplied):

POWERSHELL
Connect-ExchangeOnline -ShowBanner:$false

$upn = "[email protected]"
$mbx = Get-EXOMailbox -Identity $upn -PropertySets Hold, Quota

[PSCustomObject]@{
    UserPrincipalName       = $mbx.UserPrincipalName
    ExchangeGuid            = $mbx.ExchangeGuid
    LitigationHoldEnabled   = $mbx.LitigationHoldEnabled
    LitigationHoldDuration  = $mbx.LitigationHoldDuration
    InPlaceHolds            = ($mbx.InPlaceHolds -join ", ")
    DelayHoldApplied        = $mbx.DelayHoldApplied
} | Format-List

# If no Purview policy is present, stamp a 7-year (2555-day) Litigation Hold before deleting the account:
if (-not $mbx.LitigationHoldEnabled -and $mbx.InPlaceHolds.Count -eq 0) {
    Set-Mailbox -Identity $upn -LitigationHoldEnabled $true -LitigationHoldDuration 2555
    Write-Host "[+] Applied 7-year Litigation Hold to $upn. Wait 60 minutes before deleting the Entra ID user." -ForegroundColor Green
}
IMPORTANT:
Licensing Prerequisite: Creating an inactive mailbox requires an Exchange Online Plan 2 license (included in Microsoft 365 E3/E5) or an Exchange Online Archiving add-on license at the moment the hold is placed. Once the user account is deleted and the mailbox transitions to Inactive, the license is released back to your tenant pool.

2. Auditing All Inactive Mailboxes in Your Tenant

Use the high-performance REST cmdlet Get-EXOMailbox -InactiveMailboxOnly:

POWERSHELL
# Retrieve all Inactive Mailboxes and their Hold / SoftDelete timestamps
Get-EXOMailbox -InactiveMailboxOnly -PropertySets Hold, SoftDelete, Statistics |
    Select-Object DisplayName, PrimarySmtpAddress, ExchangeGuid, WhenSoftDeleted, LitigationHoldEnabled, @{N="InPlaceHolds";E={$_.InPlaceHolds -join ";"}} |
    Format-Table -AutoSize

3. Scenario A: Restore (Merge) an Inactive Mailbox into an Active Mailbox

When a manager or replacement team member needs historical emails from a former employee's inactive mailbox, use New-MailboxRestoreRequest with -AllowLegacyDNMismatch. This copies the data into a dedicated subfolder (e.g., FormerEmployee_Archive) inside the target mailbox while leaving the original inactive mailbox untouched for eDiscovery:

POWERSHELL
# 1. Capture the Inactive Mailbox ExchangeGuid
$inactiveMbx = Get-EXOMailbox -InactiveMailboxOnly -Filter "PrimarySmtpAddress -eq '[email protected]'"
$targetMbx   = "[email protected]"

# 2. Start the background restore into a subfolder
New-MailboxRestoreRequest `
    -Name "Restore-$($inactiveMbx.ExchangeGuid)" `
    -SourceMailbox $inactiveMbx.ExchangeGuid `
    -TargetMailbox $targetMbx `
    -TargetRootFolder "Restored - $($inactiveMbx.DisplayName)" `
    -AllowLegacyDNMismatch

# 3. Monitor restore progress
Get-MailboxRestoreRequest | Get-MailboxRestoreRequestStatistics |
    Select-Object Name, StatusDetail, PercentComplete, ItemsTransferred, BytesTransferred

4. Scenario B: Recover an Inactive Mailbox into a Live Mailbox (Rehired Employee)

If the former employee is rehired (or you need to convert the inactive mailbox into a live Shared Mailbox), use New-Mailbox -InactiveMailbox:

POWERSHELL
$inactiveMbx = Get-EXOMailbox -InactiveMailboxOnly -Filter "PrimarySmtpAddress -eq '[email protected]'"

# Convert the inactive mailbox into a new active cloud user mailbox
New-Mailbox -InactiveMailbox $inactiveMbx.ExchangeGuid `
    -Name "Alex Wilber" `
    -DisplayName "Alex Wilber" `
    -MicrosoftOnlineServicesID "[email protected]" `
    -Password (ConvertTo-SecureString -String "TempP@ssw0rd!2026" -AsPlainText -Force) `
    -ResetPasswordOnNextLogon $true
TIP:
Hybrid AD-Synced Rehire Caveat: If your organization syncs users from on-premises Active Directory via Entra Connect, recovering an inactive cloud mailbox creates a cloud-only user object first. Afterwards, match the on-premises AD user to the recovered cloud user using hard/soft matching (ImmutableId / proxyAddresses) as detailed in our Hybrid Rehire & Mailbox Conversion Guide.

5. Scenario C: Permanently Delete an Inactive Mailbox When Retention Expires

If legal counsel authorizes permanent disposal of an inactive mailbox:

POWERSHELL
$inactiveGuid = "a36dce3d-7e13-44e5-aafd-049f41e4ca44"

# 1. Remove Litigation Hold
Set-Mailbox -InactiveMailbox -Identity $inactiveGuid -LitigationHoldEnabled $false

# 2. Exclude from organization-wide Purview Retention Policies (if applicable)
Connect-IPPSSession
Set-RetentionCompliancePolicy -Identity "Global-7Year-Retention" -AddExchangeLocationException $inactiveGuid

# 3. Clear the 30-day DelayHold if immediate purge is legally required
Set-Mailbox -InactiveMailbox -Identity $inactiveGuid -RemoveDelayHoldApplied

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.