Commands › Exchange Online

Get-RetentionCompliancePolicy

Exchange Online ExchangeOnlineManagement Get-*

For more information, see Security & Compliance PowerShell. Use the Get-RetentionCompliancePolicy to view existing retention policies in the Microsoft Purview compliance portal.

Quick start script

# Get-RetentionCompliancePolicy — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Run and inspect
Get-RetentionCompliancePolicy | Format-List

# 3. Export for evidence / drift tracking
Get-RetentionCompliancePolicy | Export-Clixml .\RetentionCompliancePolicy-$(Get-Date -Format yyyyMMdd).xml

Syntax

Get-RetentionCompliancePolicy [[-Identity] <PolicyIdParameter>]
 [-DistributionDetail]
 [-ErrorPolicyOnly]
 [-ExcludeTeamsPolicy]
 [-IncludeTestModeResults]
 [-PriorityCleanup]
 [-RetentionRuleTypes]
 [-TeamsPolicyOnly]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-Identity PolicyIdParameter The Identity parameter specifies the retention policy that you want to view. You can use any value that uniquely identifies the policy. For example:
-DistributionDetail SwitchParameter The DistributionDetail switch returns detailed policy distribution information in the DistributionResults property. You don't need to specify a value with this switch.
-ErrorPolicyOnly SwitchParameter The ErrorPolicyOnly switch specifies whether to show only policies that have distribution errors in the results. You don't need to specify a value with this switch.
-ExcludeTeamsPolicy SwitchParameter The ExcludeTeamsPolicy switch specifies whether to exclude Teams policies from the results. You don't need to specify a value with this switch.
-IncludeTestModeResults SwitchParameter The IncludeTestModeResults switch specifies whether to include the status of test mode in the policy details. You don't need to specify a value with this switch.
-PriorityCleanup SwitchParameter {{ Fill PriorityCleanup Description }}
-RetentionRuleTypes SwitchParameter The RetentionRuleTypes switch specifies whether to return the value of the RetentionRuleTypes and HasRules properties in the results. You don't need to specify a value with this switch.
-TeamsPolicyOnly SwitchParameter The TeamsPolicyOnly switch specifies whether to show only Teams policies in the results. You don't need to specify a value with this switch.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.