Office 365 – Creating new retention tags and policies via PowerShell


Microsoft’s classic ECM is acting all funky and you can’t create retention tags or policies without an error.


(h/t That Lazy Admin)

How to create Retention Tags and Policies using Powershell

Connect to Exchange Powershell using the Quick Connect script Here:

Run the following command to get the current Retention Tags and Policies Get-RetentionPolicy


And Then Get-RetentionPolicyTag


Now let’s continue and create the following Retention Tag

  1. Name: Managers Deleted Items
  2. Delete and Allow Recovery set to 180 days

New-RetentionPolicyTag -Name Managers-Deleted-Items -RetentionAction DeleteAndAllowRecovery  -AgeLimitForRetention 180 -Type DeletedItems

12New-RetentionPolicyTag -Name Managers-Deleted-Items -RetentionAction DeleteAndAllowRecovery  -AgeLimitForRetention 180 -Type DeletedItems

New-RetentionPolicy -Name Keep-Deleted-Items-Management -RetentionPolicyTagLinks Managers-Deleted-Items

12New-RetentionPolicy -Name Keep-Deleted-Items-Management -RetentionPolicyTagLinks Managers-Deleted-Items