All scripts
Governance 970
Get-MailboxLitigationHoldStatus
Reports which mailboxes currently have litigation hold enabled and for how long, so holds that were meant to be temporary do not sit forgotten and keep consuming storage.
Get-MailboxLitigationHoldStatus.ps1
<#
.SYNOPSIS
Reports litigation hold status across all mailboxes.
.DESCRIPTION
Lists every mailbox with litigation hold enabled, along with the
configured hold duration, so holds that were only meant to be
temporary get noticed instead of silently running indefinitely.
.EXAMPLE
.\Get-MailboxLitigationHoldStatus.ps1
.NOTES
Requires ExchangeOnlineManagement and an active Connect-ExchangeOnline session.
.AUTHOR
Shehryar Hassan
#>
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object { $_.LitigationHoldEnabled }
if (-not $mailboxes) {
Write-Host "No mailboxes currently have litigation hold enabled." -ForegroundColor Green
return
}
$report = $mailboxes | ForEach-Object {
[pscustomobject]@{
DisplayName = $_.DisplayName
HoldEnabledDate = $_.LitigationHoldDate
DurationDays = if ($_.LitigationHoldDuration) { $_.LitigationHoldDuration } else { "Indefinite" }
HoldOwner = $_.LitigationHoldOwner
}
}
$report | Sort-Object HoldEnabledDate | Format-Table -AutoSize
Read it before you run it, and test in a safe tenant first.