Get Package CCMCache Location

Ever want to know where in the CCMCache the content was located for that package that was downloaded?  Ever think you found it, then figured out it wasn't the most updated version of the content?  I quick wrote this script to help me find where in the cache the content is located, and spits back the most updated version of it.


[Parameter(Mandatory=$true,Position=1,HelpMessage="Package ID")]

$CMObject = New-Object -ComObject 'UIResource.UIResourceMgr'
$CMCacheObjects = $CMObject.GetCacheInfo()
$OSUpgradeContent = $CMCacheObjects.GetCacheElements() | Where-Object {$_.ContentID -eq "$PackageID"}
$ContentVersion = $OSUpgradeContent.ContentVersion
$HighestContentID = $ContentVersion | measure -Maximum
$NewestContent = $OSUpgradeContent | Where-Object {$_.ContentVersion -eq $HighestContentID.Maximum}

Note, this was mostly for troubleshooting app installs, but I also found I could take advantage of this in a TS to locate content for a run commadline step.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.