Run Scripts – CCM Cache Report

This Script will grab information about the items in your CCM Cache. What this script does

  • Sets Cache Size to 25GB if not 25GB (Feel free to modify)
  • Deletes Duplicate Content, leaving only the latest version of that content
  • Reports Software Updates (Count)
    • Software Update Name
    • Software Update Status (Missing / Installed)
    • Software Update Cache Location
    • Software Size in Cache
  • Reports Packages (Count)
    • Package Name
    • Package ID
    • Package Cache Location
    • Package Size in Cache
  • Reports Applications (Count)
    • App Deployment Type Name
    • App Cache Location
    • App Size in Cache

Please note, very little testing, I’ve found that not all software updates in the CCMCache have directly related info in WMI, so not all of them populate (See Detailed Dump below).
Basically, the script runs through the CCM Cache, then TRIES to find corresponding information in WMI for the Content ID… which was a bit tricky to find. It took me forever (like an hour) to figure out how to pull in the Application Names, that info was really hidden good in WMI.

You can deploy to one PC or many. You can then look at the detailed output per machine to see more info.

Dump of Details for a machine: (Not the script, just the detailed output of running on a machine).

[
  "Change size was 20480, now 25600",
  "",
  "-----------------------------------",
  "Reporting Software Updates in Cache | Count: 25",
  "",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\2",
  "Cache Size: 21243",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\12",
  "Cache Size: 65544",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\5",
  "Cache Size: 13250",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\13",
  "Cache Size: 279597",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\15",
  "Cache Size: 13771",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\4",
  "Cache Size: 1052156",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\17",
  "Cache Size: 287811",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\w",
  "Cache Size: 64518",
  "__",
  "Name: 2019-12 Cumulative Update for Windows 10 Version 1809 for x64-based Systems (KB4530715)",
  "Status: Installed",
  "Cache Location: C:\\WINDOWS\\ccmcache\\1b",
  "Cache Size: 296952",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\s",
  "Cache Size: 64521",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\14",
  "Cache Size: 281823",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\11",
  "Cache Size: 269563",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\3",
  "Cache Size: 21227",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\16",
  "Cache Size: 65339",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\t",
  "Cache Size: 263085",
  "__",
  "Name: 2019-02 Update for Windows 10 Version 1809 for x64-based Systems (KB4465065)",
  "Status: Installed",
  "Cache Location: C:\\WINDOWS\\ccmcache\\q",
  "Cache Size: 2091",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\1",
  "Cache Size: 1575",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\10",
  "Cache Size: 13712",
  "__",
  "Name: 2019-11 Servicing Stack Update for Windows 10 Version 1809 for x64-based Systems (KB4523204)",
  "Status: Installed",
  "Cache Location: C:\\WINDOWS\\ccmcache\\18",
  "Cache Size: 13787",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\v",
  "Cache Size: 278491",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\y",
  "Cache Size: 64554",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\r",
  "Cache Size: 21241",
  "__",
  "Name: ",
  "Status: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\u",
  "Cache Size: 13714",
  "__",
  "Name: 2019-12 Cumulative Update for .NET Framework 3.5, 4.7.2 and 4.8 for Windows 10 Version 1809 for x64 (KB4533094)",
  "Status: Installed",
  "Cache Location: C:\\WINDOWS\\ccmcache\\1c",
  "Cache Size: 65176",
  "__",
  "Name: 2019-09 Security Update for Adobe Flash Player for Windows 10 Version 1809 for x64-based Systems (KB4516115)",
  "Status: Installed",
  "Cache Location: C:\\WINDOWS\\ccmcache\\z",
  "Cache Size: 21243",
  "__",
  "",
  "-----------------------------------",
  "Reporting Packages in Cache | Count: 8",
  "",
  "Name: Configuration Manager Client Upgrade Package",
  "Package ID: PS200004",
  "Cache Location: C:\\WINDOWS\\ccmcache\\19",
  "Cache Size: 4122",
  "__",
  "Name: OSD TS Scripts & Tools",
  "Package ID: PS20006A",
  "Cache Location: C:\\WINDOWS\\ccmcache\\l",
  "Cache Size: 1467",
  "__",
  "Name: OSD TS LockScreen",
  "Package ID: PS200070",
  "Cache Location: C:\\WINDOWS\\ccmcache\\m",
  "Cache Size: 142",
  "__",
  "Name: CustomW10UpgradeSplashScreen",
  "Package ID: PS20003E",
  "Cache Location: C:\\WINDOWS\\ccmcache\\k",
  "Cache Size: 1106",
  "__",
  "Name: OSD DebugMode",
  "Package ID: PS200071",
  "Cache Location: C:\\WINDOWS\\ccmcache\\n",
  "Cache Size: 88",
  "__",
  "Name: WaaS_Scripts",
  "Package ID: PS1000B2",
  "Cache Location: C:\\WINDOWS\\ccmcache\\i",
  "Cache Size: 8525",
  "__",
  "Name: WinMerge x64 Portable",
  "Package ID: PS20001F",
  "Cache Location: C:\\WINDOWS\\ccmcache\\h",
  "Cache Size: 22407",
  "__",
  "",
  "-----------------------------------",
  "Reporting Applications in Cache | Count: 6",
  "",
  "Name: ",
  "Cache Location: C:\\WINDOWS\\ccmcache\\o",
  "Cache Size: 495",
  "__",
  "Name: Ninite Chrome",
  "Cache Location: C:\\WINDOWS\\ccmcache\\6",
  "Cache Size: 5",
  "__",
  "Name: WMIExplorer",
  "Cache Location: C:\\WINDOWS\\ccmcache\\8",
  "Cache Size: 819",
  "__",
  "Name: Script",
  "Cache Location: C:\\WINDOWS\\ccmcache\\7",
  "Cache Size: 2183",
  "__",
  "Name: BCMon",
  "Cache Location: C:\\WINDOWS\\ccmcache\\1a",
  "Cache Size: 370",
  "__",
  "Name: Local Administrator Password Solution - Windows Installer (*.msi file)",
  "Cache Location: C:\\WINDOWS\\ccmcache\\x",
  "Cache Size: 996",
  "__",
  "Total Cache Items: 39",
  "Cache Size Used: 5204",
  "Cache Size Free: 20396"
]

Screen Shot of the Code in ISE:

https://gist.github.com/gwblok/3dad4888655bb166ca484e6847e104ee

This script is only reporting, I have others for deleting specific content, or all software updates for example, just search my blog for ccmcache. For a Nifty Pro-Active way to manage your cache, look here: https://www.scconfigmgr.com/2017/02/21/sccm-client-cache-maintenance-configuration-baseline/ .
We at #BigBank also use a baseline to manage our difference caches, maybe someday @MikeTerrill will blog that.

GARYTOWN

2 thoughts on “Run Scripts – CCM Cache Report”

Leave a Reply to Nick Stoll Cancel reply

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