Commands › Exchange Online

Set-RetentionPolicy

Exchange Online ExchangeOnlineManagement Set-*

Change the properties of an existing retention policy.

Quick start script

# Set-RetentionPolicy — 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-RetentionPolicy
$before | Format-List

# 3. Make the change (dry run first)
Set-RetentionPolicy -Identity <MailboxPolicyIdParameter> -WhatIf
Set-RetentionPolicy -Identity <MailboxPolicyIdParameter>

# 4. Verify and diff
$after = Get-RetentionPolicy
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-RetentionPolicy [-Identity] <MailboxPolicyIdParameter>
 [-Confirm]
 [-DomainController <Fqdn>]
 [-Force]
 [-IsDefault]
 [-IsDefaultArbitrationMailbox]
 [-Name <String>]
 [-RetentionId <Guid>]
 [-RetentionPolicyTagLinks <RetentionPolicyTagIdParameter[]>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (10)

ParameterTypeRequiredWhat it controls
-Identity MailboxPolicyIdParameter yes The Identity parameter specifies the name, distinguished name (DN), or GUID of the retention policy.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-IsDefault SwitchParameter This parameter is available only in the cloud-based service.
-IsDefaultArbitrationMailbox SwitchParameter This parameter is available only in the cloud-based service.
-Name String The Name parameter specifies a unique name for the retention policy.
-RetentionId Guid The RetentionId parameter specifies the identity of the retention policy to make sure mailboxes moved between two Exchange organizations continue to have the same retention policy applied to them. For example, in a...
-RetentionPolicyTagLinks RetentionPolicyTagIdParameter[] The RetentionPolicyTagLinks parameter specifies the identity of retention policy tags to associate with the retention policy. Mailboxes that get a retention policy applied have retention tags linked with that...
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. 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.