Below is a list of useful commands we can use to view set retention policies on Office 365 mailboxes through Azure AD PowerShell. Again, we will need to connect to the tenant using the Azure AD PowerShell module to make the setting changes.
These same commands can be used within an Exchange 2013 environment as well.
List all of the currently available retention policies and assigned retention tags…
Get-RetentionPolicy | ft -auto Name,RetentionPolicyTagLinks
List a retention policy currently set for an individual mailbox…
Get-Mailbox -Identity "USER_ALIAS" | ft Alias,RetentionPolicy
Get the list of retention policies set on all O365 mailboxes…
Get-Mailbox -ResultSize Unlimited | ft -auto Alias,RetentionPolicy
Set a retention policy for an individual O365 mailbox…
Set-Mailbox -Identity "USER_ALIAS" -RetentionPolicy "RETENTION_POLICY_NAME"
Set a retention policy on all O365 mailboxes…
Get-Mailbox -ResultSize Unlimited | Set-Mailbox -RetentionPolicy "RETENTION_POLICY_NAME"
Remove a retention policy from an individual mailbox…
Set-Mailbox -Identity "USER_ALIAS" -RetentionPolicy $null
Set an existing retention policy as the default retention policy for your organization. This may or may not set the assigned policy permanently as the “IsDefault” parameter is reserved for internal Microsoft use. The default retention policy name in Exchange and Exchange Online is “Default MRM Policy“.
Set-RetentionPolicy -Identity "RETENTION_POLICY_NAME" -IsDefault:$True
Related Articles in this Blog:
- Enforce Retention Policies in Exchange and Office 365 via PowerShell
- Enable Mailbox Archive in Exchange Hybrid via PowerShell
- How to apply Retention Policies to all mailboxes
- Changing the Organization’s Default MRM Policy (Default Retention Policy)?