Skip to main content
Exchange Online · PowerShell 7.6

Mailboxes on litigation hold (or not)

Which mailboxes are on litigation hold, since when, for how long and placed by whom? Or, with -NotOnHold, which mailboxes aren't, for example before someone leaves.

Script

#Requires -Modules ExchangeOnlineManagement
# Mailboxes on litigation hold (or, with -NotOnHold, mailboxes that are not). Read-only.
param(
    [switch]$NotOnHold
)

Connect-ExchangeOnline -ShowBanner:$false

Get-EXOMailbox -ResultSize Unlimited -PropertySets Minimum, Hold |
    Where-Object { [bool]$_.LitigationHoldEnabled -ne [bool]$NotOnHold } |
    Sort-Object UserPrincipalName |
    Select-Object UserPrincipalName, RecipientTypeDetails, LitigationHoldEnabled, LitigationHoldDate, LitigationHoldDuration, LitigationHoldOwner

Checked automatically against Microsoft's published cmdlet reference. KBY hasn't run it in your tenant; run it in a test environment first.

Reading the output

  • Reads the Hold property set of Get-EXOMailbox. LitigationHoldDuration is a number of days counted from when each item was received or created, or unlimited (the default), per the Set-Mailbox reference.
  • LitigationHoldOwner is the user who placed the hold; it is filled in automatically if no owner was given.
  • Only litigation hold is reported. Retention policies and eDiscovery holds are separate.
  • ExchangeOnlineManagement 3.10.0 and later require PowerShell 7.6 when run in PowerShell 7 (Windows PowerShell 5.1 is unaffected), per the module release notes.

Sources

The Microsoft reference page for every cmdlet the script calls, plus the API and product pages behind each permission and caveat.

All scripts