Commands › Exchange Online
Set-HoldCompliancePolicy
For more information, see Security & Compliance PowerShell. Use the Set-HoldCompliancePolicy cmdlet to modify existing preservation policies in the Microsoft Purview compliance portal. **Note**: The Set-HoldCompliancePolicy cmdlet is replaced by the Set-RetentionCompliancePolicy cmdlet. If you have scripts that use Set-HoldCompliancePolicy, update them to use Set-RetentionCompliancePolicy.
Quick start script
# Set-HoldCompliancePolicy — 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-HoldCompliancePolicy
$before | Format-List
# 3. Make the change (dry run first)
Set-HoldCompliancePolicy -Identity <PolicyIdParameter> -RetryDistribution <SwitchParameter> -WhatIf
Set-HoldCompliancePolicy -Identity <PolicyIdParameter> -RetryDistribution <SwitchParameter>
# 4. Verify and diff
$after = Get-HoldCompliancePolicy
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 2 parameter sets
RetryDistribution
Set-HoldCompliancePolicy [-Identity] <PolicyIdParameter>
[-RetryDistribution]
[-Confirm]
[-WhatIf]
[<CommonParameters>]
Identity
Set-HoldCompliancePolicy [-Identity] <PolicyIdParameter>
[-AddExchangeLocation <MultiValuedProperty>]
[-AddPublicFolderLocation <MultiValuedProperty>]
[-AddSharePointLocation <MultiValuedProperty>]
[-Comment <String>]
[-Confirm]
[-Enabled <Boolean>]
[-Force]
[-RemoveExchangeLocation <MultiValuedProperty>]
[-RemovePublicFolderLocation <MultiValuedProperty>]
[-RemoveSharePointLocation <MultiValuedProperty>]
[-WhatIf]
[<CommonParameters>]
Parameters (13)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.