All scripts
Governance 348
Get-PurviewEdiscoveryHoldReport
Lists every eDiscovery case and the holds within it, along with the locations each hold covers, so an old hold from a closed case does not keep data locked up indefinitely.
Get-PurviewEdiscoveryHoldReport.ps1
<#
.SYNOPSIS
Reports eDiscovery cases and their active holds.
.DESCRIPTION
Lists every eDiscovery case with the holds configured inside it and
the mailboxes or sites each hold covers, so an old hold left over
from a closed case does not keep data locked up indefinitely without
anyone noticing.
.EXAMPLE
.\Get-PurviewEdiscoveryHoldReport.ps1
.NOTES
Requires the ExchangeOnlineManagement module connected to Security &
Compliance PowerShell (Connect-IPPSSession).
.AUTHOR
Shehryar Hassan
#>
$cases = Get-ComplianceCase
$report = foreach ($case in $cases) {
$holds = Get-CaseHoldPolicy -Case $case.Name -ErrorAction SilentlyContinue
foreach ($hold in $holds) {
[pscustomobject]@{
CaseName = $case.Name
CaseStatus = $case.Status
HoldName = $hold.Name
Enabled = $hold.Enabled
Locations = ($hold.ExchangeLocation + $hold.SharePointLocation) -join ", "
}
}
}
$report | Format-Table -AutoSize
Write-Host "$($cases | Where-Object Status -eq 'Closed' | Measure-Object).Count closed case(s) — review their holds for removal." -ForegroundColor Yellow
Read it before you run it, and test in a safe tenant first.