Get Configuration Manager Client Cache Size using PowerShell

In this short post we will see how to get configuration manager client cache size using powershell. In one of my recent post we saw Configuration Manager 1606 Client Cache Settings overview. To brief about it, in version 1606 of Configuration manager you can manage the client cache size efficiently. There is no need of powershell or VB script to change the client cache size.

However I did observe some strange thing after changing the client cache size in client settings. Upon checking the Cache tab of configuration manager properties, the settings were greyed out. I could not see the client cache size nor click configure settings. The amount of disk space showed value ‘0’.

Get Configuration Manager Client Cache Size using PowerShell

Get Configuration Manager Client Cache Size using PowerShell

PowerShell always comes handy when you want to retrieve data which is not possible from GUI method. On the client machine, run the PowerShell as administrator. In the below screenshot the first command that I used is :-

Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent

When you run the above command, it asks for class value. Specify the class as CacheConfig and press enter. You now see it shows data such as location of ccmcache folder, size of cache and computer name. This is one way to know the client cache size.

Get Configuration Manager Client Cache Size using PowerShell

In the below screenshot, I have used the same command but I have appended with -Query. In other words I am supplying the class value parameter in the command itself.

Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent -Query "Select Size from CacheConfig"

When we enter the above command, we see the size of sccm client cache.

The last command is a one line command that shows the size of sccm client cache. Here’s the command used :-

Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent -Query "Select Size from CacheConfig" | Select-Object -ExpandProperty "Size"
Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent -Query "Select Size from CacheConfig" | Select Size

Get Configuration Manager Client Cache Size using PowerShell

4 Comments

  1. It works for me.
    Get-CimInstance -ClassName CacheConfig -Namespace ROOT\CCM\SoftMgmtAgent

  2. Avatar photo Aaron Krueger says:

    This method really doesn’t work anymore. As soon as you restart ccmexec and the machine processes client settings policy it will revert to the value contained in the policy. If you’re not setting cache size via client policy…well…not sure why you wouldn’t.

  3. How do you extend this to find size of cache (actual data) or free space in ccmcache folder?

    1. Avatar photo SIVA KRISHNA says:

      Exactly, Even I’m looking for the same. We can manually write a powershell script but looking for a sql query or any inventory extensions for free space in ccmcache so that it can be used in PowerBI in our environment

Leave a Reply

Your email address will not be published. Required fields are marked *