Exchange 2013 CU12 Upgrade Error: Retention Tag

Issue

Today I was working with one of my customer where i ran into an issue with Exchange 2013 CU update. Customer already had Exchange 2013 CU5 deployed and we were trying to install Exchange 2013 CU12. When we ran the Exchange 2013 CU12 setup, we got the following error message on first step of Exchange 2013 CU12 deployment.

Error:
The following error was generated when “$error.Clear();
$tagConstant = [Microsoft.Exchange.Management.SystemConfigurationTasks.RetentionPolicyTagConstant];
$rptNames = $tagConstant::PersonalOneYearMoveToArchive,`
$tagConstant::DefaultTwoYearMoveToArchive,`
$tagConstant::PersonalFiveYearMoveToArchive,`
$tagConstant::PersonalNeverMoveToArchive;
$rptTypes = ‘Personal’, ‘All’, ‘Personal’, ‘Personal’;
$rptMCs = ‘*’, ‘*’, ‘*’, ‘*’;
$rptAges = ‘365’, ‘730’, ‘1825’, ‘0’;
$tagGuidMap = $tagConstant::RetentionTagGuidMap;
for($i=0; $i -lt $rptNames.Length; $i++)
{
[Guid] $retentionId = $tagGuidMap[$rptNames[$i]];
$archiveRPT = Get-RetentionPolicyTag -IncludeSystemTags -DomainController $RoleDomainController | where {$_.Name -eq $rptNames[$i] -or $_.RetentionId -eq $retentionId};
if ( !$archiveRPT )
{
Write-ExchangeSetupLog -Info “Retention policy tag ‘$($rptNames[$i])’ does not exist, create new.”
if( $i -ne $rptNames.Length-1 )
{
new-RetentionPolicyTag -Name $rptNames[$i] -Type $rptTypes[$i] -SystemTag:$false -RetentionEnabled:$true -RetentionAction MoveToArchive -AgeLimitForRetention $rptAges[$i] -MessageClass $rptMCs[$i] -DomainController $RoleDomainController -RetentionId $retentionId;
}
else
{
new-RetentionPolicyTag -Name $rptNames[$i] -Type $rptTypes[$i] -SystemTag:$false -RetentionEnabled:$false -RetentionAction MoveToArchive -MessageClass $rptMCs[$i] -DomainController $RoleDomainController -RetentionId $retentionId;
}
}
else
{
if ( $archiveRPT.SystemTag -eq $true )
{
Write-ExchangeSetupLog -Info “Retention policy tag ‘$($rptNames[$i])’ exist and it is a system tag, set it to non-system tag.”
Set-RetentionPolicyTag -Identity $archiveRPT.Identity -SystemTag:$false;
}
}
}

$deleteRptNames = $tagConstant::OneWeekDelete,`
$tagConstant::OneMonthDelete,`
$tagConstant::SixMonthDelete,`
$tagConstant::OneYearDelete,`
$tagConstant::FiveYearDelete,`
$tagConstant::NeverDelete;
$deleteRptTypes = ‘Personal’, ‘Personal’, ‘Personal’, ‘Personal’, ‘Personal’, ‘Personal’;
$deleteRptMCs = ‘*’, ‘*’, ‘*’, ‘*’, ‘*’, ‘*’;
$deleteRptAges = ‘7’, ’30’, ‘180’, ‘365’, ‘1825’, ‘0’;
for($i=0; $i -lt $deleteRptNames.Length; $i++)
{
[Guid] $retentionId = $tagGuidMap[$deleteRptNames[$i]];
$deleteRPT = Get-RetentionPolicyTag -IncludeSystemTags -DomainController $RoleDomainController | where {$_.Name -eq $deleteRptNames[$i] -or $_.RetentionId -eq $retentionId};
if ( !$deleteRPT )
{
Write-ExchangeSetupLog -Info “Retention policy tag ‘$($deleteRptNames[$i])’ does not exist, create new.”
if( $i -ne $deleteRptNames.Length-1 )
{
new-RetentionPolicyTag -Name $deleteRptNames[$i] -Type $deleteRptTypes[$i] -SystemTag:$false -RetentionEnabled:$true -RetentionAction DeleteAndAllowRecovery -AgeLimitForRetention $deleteRptAges[$i] -MessageClass $deleteRptMCs[$i] -DomainController $RoleDomainController -RetentionId $retentionId;
}
else
{
new-RetentionPolicyTag -Name $deleteRptNames[$i] -Type $deleteRptTypes[$i] -SystemTag:$false -RetentionEnabled:$false -RetentionAction DeleteAndAllowRecovery -MessageClass $deleteRptMCs[$i] -DomainController $RoleDomainController -RetentionId $retentionId;
}
}
}

$dumpsterRPTName = $tagConstant::RecoverableItemsFourteenDaysMoveToArchive;
[Guid] $retentionId = $tagGuidMap[$dumpsterRPTName];
$dumpsterRPT = Get-RetentionPolicyTag -DomainController $RoleDomainController | where {$_.Name -eq $dumpsterRPTName -or $_.RetentionId -eq $retentionId};
if (!$dumpsterRPT)
{
New-RetentionPolicyTag -Name $dumpsterRPTName -Type RecoverableItems -RetentionAction MoveToArchive -AgeLimitForRetention 14 -DomainController $RoleDomainController -RetentionId $retentionId;
}
else
{
Write-ExchangeSetupLog -warning “Was not able to create new RecoverableItems tag because a tag with the name ‘$dumpsterRPTName’ already exists. Please run ‘new-RetentionPolicyTag -Type RecoverableItems’ to create a RecoverableItems tag.”
}

$policyName = [Microsoft.Exchange.Management.Common.RecipientConstants]::DefaultArchiveAndRetentionPolicyName;
$defaultArchivePolicy = Get-RetentionPolicy -DomainController $RoleDomainController | where {$_.Name -eq $policyName};
if ( !$defaultArchivePolicy )
{
Write-ExchangeSetupLog -Info “Retention policy ‘$($policyName)’ does not exist, create new.”
new-RetentionPolicy -Name $policyName -RetentionPolicyTagLinks $rptNames[0],$rptNames[1],$rptNames[2],$rptNames[3],$dumpsterRPTName,$deleteRptNames[0],$deleteRptNames[1],$deleteRptNames[2],$deleteRptNames[3],$deleteRptNames[4],$deleteRptNames[5]  -DomainController $RoleDomainController;
}
” was run: “Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException: No retention policy tag with name ‘Default 2 year move to archive’ was found in the Active Directory.  Make sure the retention policy tag name is spelled correctly.
at Microsoft.Exchange.Configuration.Tasks.DataAccessTask`1.GetDataObject[TObject](IIdentityParameter id, IConfigDataProvider session, ObjectId rootID, OptionalIdentityData optionalData, Nullable`1 notFoundError, Nullable`1 multipleFoundError, ExchangeErrorCategory errorCategory)
at Microsoft.Exchange.Management.Tasks.NewRetentionPolicy.<InternalValidate>b__0(RetentionPolicyTagIdParameter x)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Exchange.Management.Tasks.NewRetentionPolicy.InternalValidate()
at Microsoft.Exchange.Configuration.Tasks.Task.<ProcessRecord>b__b()
at Microsoft.Exchange.Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean terminatePipelineIfFailed)”.

Solution

Looking at the error message we can see that exchange CU12 deployment was checking the default parameters of Exchange 2013 deployment and unable to find Retention policy with the name of “Default 2 year move to archive“. When i looked at Exchange 2013 Admin Center, we found that the policy tag is missing under retention tag.

The solution to this problem is to create a retention tag with the name of Default 2 year move to archive. Once the tag is created, make sure AD is replicated and then try again. It will fix your issue with CU12 deployment.