Translate “Content_" folders into plain English in the 2012 ConfigMgr Content Library

Understanding and troubleshooting the new content library in Configuration Manager 2012 can be daunting at first.  In ConfigMgr 2007, packages followed a standard XXXYYYYY package ID format, so you could look in your \SMSPKGX$ directory and know which package was which.

With the introduction of applications in Configuration Manager 2012, applications and packagaes are now stored in a \SCCMContentLib folder, within the DataLib, FileLib, and PkgLib sub-folders.  For more information on how these folders are used, see this blog post.

Now, what if you’re looking in distmgr.log and see something like “Taking snapshot for content Content_54e07188-f697-44d3-8b2b-eb09234522be.1 from source \\server\share

Or on a client’s CAS.log stating something like “Download started for content 0d5f261e-87c7-4e5d-872f-c92b12e1ac78.1”

Or while looking at a client’s Datatransferservice.log you run into an entry like “UpdateURLWithTransportSettings(): NEW URL - https://mylab.com:80/SMS\_DP\_SMSPKG$/Content\_65fbb8e9-8de2-42da-ae80-44e52e44f95e.1

Or maybe you’re looking through your Content Library’s DataLib and see the Content_ folders and want to know which applications they map to.

image

Quickly determining via the admin console which package is being referenced can be a challenge – you could add the “Content ID” column and go to the deployment types tab of each application to find a match…  Your mouse may quickly tire out.

I created an easier way using PowerShell to translate the Content_ directories into plain English package IDs and names.  Below is an example of what this looks like in action.  Just run the script, supplying the –dbserver, –dbname, and –content switches.  If you just run .\contentxlate.ps1 without any switches, you’ll be prompted to enter each value.

image

Alternatively, you could create a single report to list out all applications with their Content_ folders and associated Pkg IDs:

 

image

 

 

Here are both solutions depending on your needs.

SQL QUERY for a REPORT

SELECT LP.DisplayName,
CP.CI_ID,
CPS.PkgID,
CPS.ContentSubFolder
FROM dbo.CI_ContentPackages CPS
INNER JOIN dbo.CIContentPackage CP
ON CPS.PkgID = CP.PkgID
LEFT OUTER JOIN dbo.CI_LocalizedProperties LP
ON CP.CI_ID = LP.CI_ID
ORDER BY LP.LocaleID DESC

 

 POWERSHELL SCRIPT
 <#
.EXAMPLE
    PS C:\Scripts> .\contentxlate.ps1 -dbserver yourdbserver.local -dbname CM_XXX -content Content_54e07188-f697-44d3-8b2b-eb09234522be.1

.NOTES
    NAME: contentxlate.ps1
    VERSION: 0.1
    AUTHOR: Russ Rimmerman, Premier Field Engineer
    LASTEDIT: December 17, 2013
    Change history:
        12.17.2013: Created script
#>

Param(    
    [parameter(
    Position = 0, 
    Mandatory=$true )
    ] 
    [ValidateNotNullOrEmpty()]
    [string]$dbserver="",
    
    [parameter(
    Position = 1, 
    Mandatory=$true )
    ]
    [ValidateNotNullOrEmpty()]
    [string]$dbname="",

    [parameter(
    Position = 2, 
    Mandatory=$true )
    ] 
    [ValidateNotNullOrEmpty()]
    [string]$content=""
    
)

$sqlquery = "SELECT LP.DisplayName,
CP.CI_ID,
CPS.PkgID
FROM dbo.CI_ContentPackages CPS
INNER JOIN dbo.CIContentPackage CP
ON CPS.PkgID = CP.PkgID
LEFT OUTER JOIN dbo.CI_LocalizedProperties LP
ON CP.CI_ID = LP.CI_ID
WHERE CPS.ContentSubFolder = `'"
$sqlquery += $content
$sqlquery += "`' ORDER BY LP.LocaleID DESC"

invoke-sqlcmd -Serverinstance $dbserver -database $dbname -query $sqlquery