ConfigMgr 2012 support tip: Migrating an application to a new hierarchy creates new Content ID

~ John Philpott

FIXHi everyone, John Philpott here with a quick tip for you on an issue where applications may get a new content ID after migrating to a new System Center 2012 R2 Configuration Manager Service Pack 1 (SP1) environment.

The Scenario

You are migrating your current System Center 2012 Configuration Manager infrastructure to a new ConfigMgr 2012 R2 SP1 environment. Your original environment includes applications which are to be migrated over to the new environment. To allow for a phased migration, you have set up shared distribution points in the original environment.

The Problem

Once you migrate your applications to the new ConfigMgr 2012 R2 SP1 environment, you find that a large number of those applications have received a new Application Deployment Type Content_UniqueID. This causes clients to not be able to download content in the new environment from the shared distribution point, as they do not recognize the Content_UniqueID.

The Cause

This can occur if the applications that were created had a source directory that didn't end with a backslash (the \ character). This is because in ConfigMgr 2012 R2 SP1, any application created that doesn't have the trailing '\' in its source gets it added automatically.

The Resolution

To resolve this issue, or to prevent it from happening in the first place, from the old site, update the source path to include a trailing ‘\’ on any application that is missing one (or any app that is getting a new Content_UniqueID after migration).

If you have not begun your migration yet, no further steps are required. If you have discovered this issue post migration, after you complete the step above, re-migrate the application using the “overwrite” option.

After these steps, migrated applications will maintain the same Content_UniqueID.

Optional Script

PFE Ken Smith wrote a PS script that will scan for, and optionally correct, application deployment types that are missing a trailing '\' in the content location path. His sample script can be found below:

<— COPY FROM BELOW —>
# Ken Smith
# Microsoft Premier Field Engineer (PFE)
#
https://twitter.com/pfeken
# http://blogs.technet.com/b/kensmith/
#
# 9/2/2015
# Rev 1.0
#
# This script will scan for, and optionally correct, application deployment types that are missing a trailing "\"
# in the content location path. This will allow for proper migration to 2012 SP2/R2 SP1 without generating a new ContentID
#
# Usage: Verify-ContentLocation -SiteCode <SiteCode> -FixMe <$True> (Optional)
#
#
# This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 
# THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 
# We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object
# code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
# product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the
# Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims
# or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.
Param(
  [parameter(Mandatory=$True)][string]$SiteCode,
  [bool]$FixMe
)
import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
CD "$($SiteCode):\"
$LogFile = "$($Env:Temp)\Verify-ContentLocation$(get-date -Format HHmmss).txt"
Write-Host "Logging to $LogFile"
Function LogWrite {
    Param([String]$logstring)
    Write-Host $logstring
    Add-Content -Path $LogFile -Value $logstring
}
LogWrite "Gathering Applications"
$apps = Get-CMApplication
foreach ($app in $apps)
{
LogWrite "Processing Application $($app.LocalizedDisplayName)"
    $SDMXML = [XML]$App.SDMPackageXML
    $DeploymentTypes = $SDMXML.AppMgmtDigest.DeploymentType
foreach ($DeploymentType in $DeploymentTypes)
{
        If ($DeploymentType.Technology -eq "Script" -or $DeploymentType.Technology -eq "MSI") {
            If(-Not $DeploymentType.Installer.Contents.Content.Location.EndsWith("\")){
                LogWrite "…found corrupt ContentLocation – $($DeploymentType.Title.InnerText) – $($DeploymentType.Installer.Contents.Content.Location)"
                If ($fixme){
                    LogWrite "……setting Content Location – $($DeploymentType.Installer.Contents.Content.Location)\"
                    Set-CMDeploymentType -ApplicationName $app.LocalizedDisplayName -DeploymentTypeName $DeploymentType.Title.InnerText -MsiOrScriptInstaller -ContentLocation "$($DeploymentType.Installer.Contents.Content.Location)\"
                }
            }
        }
}
}
<— COPY FROM ABOVE —>

NOTE In ConfigMgr 2012 R2 SP1 and/or ConfigMgr 2012 SP2, content paths will always have a trailing ‘\’ appended. Because of this, this issue should not occur with content created using those versions.

DISCLAIMER As with all scripts like this, this script is not supported under any Microsoft support program or service. The sample script above is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample script remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample script, even if Microsoft has been advised of the possibility of such damages.

John Philpott | Support Escalation Engineer

Get the latest System Center news on Facebook and Twitter:

clip_image001 clip_image002

System Center All Up: http://blogs.technet.com/b/systemcenter/

Configuration Manager Support Team blog: http://blogs.technet.com/configurationmgr/ 
Data Protection Manager Team blog: http://blogs.technet.com/dpm/ 
Orchestrator Support Team blog: http://blogs.technet.com/b/orchestrator/ 
Operations Manager Team blog: http://blogs.technet.com/momteam/ 
Service Manager Team blog: http://blogs.technet.com/b/servicemanager 
Virtual Machine Manager Team blog: http://blogs.technet.com/scvmm

Microsoft Intune: http://blogs.technet.com/b/microsoftintune/
WSUS Support Team blog: http://blogs.technet.com/sus/
The RMS blog: http://blogs.technet.com/b/rms/
App-V Team blog: http://blogs.technet.com/appv/
MED-V Team blog: http://blogs.technet.com/medv/
Server App-V Team blog: http://blogs.technet.com/b/serverappv
The Surface Team blog: http://blogs.technet.com/b/surface/
The Application Proxy blog: http://blogs.technet.com/b/applicationproxyblog/

The Forefront Endpoint Protection blog : http://blogs.technet.com/b/clientsecurity/
The Forefront Identity Manager blog : http://blogs.msdn.com/b/ms-identity-support/
The Forefront TMG blog: http://blogs.technet.com/b/isablog/
The Forefront UAG blog: http://blogs.technet.com/b/edgeaccessblog/

ConfigMgr 2012 R2