ei00004
asked on
PS command to link a Retention Policy tag without deleting Existing tags in Exchange 2010
Is it possible to link more than one retention policy tag to a retention policy? If so, then what is the PowerShell command to do this?
Of course, as long as they don't conflict. See here: https://docs.microsoft.com/en-us/powershell/module/exchange/set-retentionpolicy?view=exchange-ps
ASKER
Hello Michael, The PS command in the link you sent replaces all existing policy tags in the retention policy with the policy tag in the statement, it does not add the policy tags to the existing tags. I'm actually needing a way to add policy tags to the existing tags via PS.
And that's the command you use.
$pol = Get-RetentionPolicy <policy-name>
$tag = Get-RetentionPolicyTag <new-tag-name>
$ary = $pol.RetentionPolicyTagLinks | select -exp DistinguishedName
$ary += $tag.DistinguishedName
Set-RetentionPolicy <policy-name> -RetentionPolicyTagLinks $ary
ASKER
Thanks for the script, however when I run it, the script fails with "No retention policy tag with name"
CN=The Existing Policy Tag,DC=Domain,DC=comCN=New Policy Tag to Add,DC=Domain,DC=com
Although I'm not a PS programmer, it appears to fail due to no separator (shown in bold above) between the Existing policy name and the New Policy to be added name.
CN=The Existing Policy Tag,DC=Domain,DC=comCN=New Policy Tag to Add,DC=Domain,DC=com
Although I'm not a PS programmer, it appears to fail due to no separator (shown in bold above) between the Existing policy name and the New Policy to be added name.
I tested it before I sent it to you.
I just had a thought. Does the existing retention policy only have one tag?
I just had a thought. Does the existing retention policy only have one tag?
ASKER
Yes it does.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
At the end of line 5, shouldn't $a be $ary? I ran the script using $ary at the end of line 5, if I already have one tag in the policy the script will add a second tag. If I have two tags in the policy the script will replace the 2nd tag with the new tag to be added.
Yes, fixed above. I tried this with one through five tags and it works. It never replaces, it always appends.
ASKER
Ok I just ran it again and this time it did add a 3rd tag.
Question: Isn't the ability to add tags determine by the TYPE of tag you are trying to add ie: Default policy tag (DPT), Retention policy tags (RPTs), Personal tags?
Question: Isn't the ability to add tags determine by the TYPE of tag you are trying to add ie: Default policy tag (DPT), Retention policy tags (RPTs), Personal tags?
The ability to add tags is determined by whether the tags conflict or not within a single policy.
If tags conflict, Set-RetentionPolicy should give you an error.
If tags conflict, Set-RetentionPolicy should give you an error.
ASKER
Michael B. Smith was the only EE consultant that addressed/resolved my issue.