All scripts
Governance 934

Get-PurviewRetentionPolicyReport

Lists every retention policy and label with its scope, retention period and delete action, in one table so retention configuration can be audited without opening the compliance center.

Get-PurviewRetentionPolicyReport.ps1
<#
.SYNOPSIS
    Reports all retention policies and labels tenant wide.

.DESCRIPTION
    Lists every retention policy and retention label with its scope,
    retention duration and end-of-retention action, so the tenant's
    entire retention configuration can be audited from one export
    instead of clicking through the compliance center.

.EXAMPLE
    .\Get-PurviewRetentionPolicyReport.ps1

.NOTES
    Requires the ExchangeOnlineManagement module connected to Security &
    Compliance PowerShell (Connect-IPPSSession).

.AUTHOR
    Shehryar Hassan
#>

$policies = Get-RetentionCompliancePolicy
$rules = Get-RetentionComplianceRule

$report = foreach ($policy in $policies) {
    $rule = $rules | Where-Object { $_.Policy -eq $policy.Name }
    [pscustomobject]@{
        PolicyName      = $policy.Name
        Enabled         = $policy.Enabled
        RetentionDays   = $rule.RetentionDuration
        Action          = $rule.RetentionComplianceAction
        Locations       = ($policy.ExchangeLocation + $policy.SharePointLocation) -join ", "
    }
}

$report | Format-Table -AutoSize

Read it before you run it, and test in a safe tenant first.