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.

 

[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,Position=1,HelpMessage="Package ID")]
[ValidateNotNullOrEmpty()]
[string]$PackageID
)

$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}
$NewestContent.Location

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.

3 thoughts on “Get Package CCMCache Location”

  1. Hi, Thanks for the above script its too useful to me, but i am not able to find by using content ID, pls help me on that. and also I like to remove the single app or package from ccmcahe folder after finding its location. How can i achieve that, pls help me…

    Reply
  2. Hi Gary, i don’t know powershell scripting, pls help me. I know you are a busy person, but pls help me once.
    Here is my requirement…
    I like to search 3 to 4 apps or pkgs in ccmcache and delete those items from ccmcache folder.
    I need to delete the particular apps or pkgs folders from the ccmcache folder.

    Hope you got my point. pls help me buddy.

    Reply

Leave a Reply to krishna Cancel reply

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