Office 365 – Creating new retention tags and policies via PowerShell

Problem:

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

Solution:

(h/t That Lazy Admin)

How to create Retention Tags and Policies using Powershell

Connect to Exchange Powershell using the Quick Connect script Here: https://gallery.technet.microsoft.com/Connect-To-Office-365-9b235018?redir=0

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

1Get-RetentionPolicy

And Then Get-RetentionPolicyTag

1Get-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