Commands › Exchange Online
New-RetentionCompliancePolicy
For more information, see Security & Compliance PowerShell. Use the New-RetentionCompliancePolicy cmdlet to create new retention policies and new retention label policies in the Microsoft Purview compliance portal. Creating a new policy also requires use of the New-RetentionComplianceRule cmdlet.
Quick start script
# New-RetentionCompliancePolicy — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-RetentionCompliancePolicy
$before | Format-List
# 3. Make the change (dry run first)
New-RetentionCompliancePolicy -Name <String> -AdaptiveScopeLocation <MultiValuedProperty> -WhatIf
New-RetentionCompliancePolicy -Name <String> -AdaptiveScopeLocation <MultiValuedProperty>
# 4. Verify and diff
$after = Get-RetentionCompliancePolicy
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 3 parameter sets
Default
New-RetentionCompliancePolicy [-Name] <String>
[-Applications <MultiValuedProperty>]
[-Comment <String>]
[-Confirm]
[-Enabled <Boolean>]
[-ExchangeLocation <MultiValuedProperty>]
[-ExchangeLocationException <MultiValuedProperty>]
[-Force]
[-IsSimulation]
[-ModernGroupLocation <MultiValuedProperty>]
[-ModernGroupLocationException <MultiValuedProperty>]
[-OneDriveLocation <MultiValuedProperty>]
[-OneDriveLocationException <MultiValuedProperty>]
[-PolicyRBACScopes <MultiValuedProperty>]
[-PolicyTemplateInfo <PswsHashtable>]
[-PriorityCleanup]
[-PublicFolderLocation <MultiValuedProperty>]
[-RestrictiveRetention <Boolean>]
[-RetainCloudAttachment <Boolean>]
[-SharePointLocation <MultiValuedProperty>]
[-SharePointLocationException <MultiValuedProperty>]
[-SkipPriorityCleanupConfirmation]
[-SkypeLocation <MultiValuedProperty>]
[-SkypeLocationException <MultiValuedProperty>]
[-WhatIf]
[<CommonParameters>]
TeamLocation
New-RetentionCompliancePolicy [-Name] <String>
[-Comment <String>]
[-Confirm]
[-Enabled <Boolean>]
[-Force]
[-IsSimulation]
[-PriorityCleanup]
[-RestrictiveRetention <Boolean>]
[-RetainCloudAttachment <Boolean>]
[-SkipPriorityCleanupConfirmation]
[-TeamsChannelLocation <MultiValuedProperty>]
[-TeamsChannelLocationException <MultiValuedProperty>]
[-TeamsChatLocation <MultiValuedProperty>]
[-TeamsChatLocationException <MultiValuedProperty>]
[-WhatIf]
[<CommonParameters>]
AdaptiveScopeLocation
New-RetentionCompliancePolicy [-Name] <String> -AdaptiveScopeLocation <MultiValuedProperty>
[-Applications <MultiValuedProperty>]
[-Comment <String>]
[-Confirm]
[-Enabled <Boolean>]
[-Force]
[-IsSimulation]
[-PriorityCleanup]
[-RestrictiveRetention <Boolean>]
[-RetainCloudAttachment <Boolean>]
[-SkipPriorityCleanupConfirmation]
[-WhatIf]
[<CommonParameters>]
Parameters (30)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.