Get Configuration Manager Client Cache Size using PowerShell

471

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 PowerShellGet 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 PowerShellIn 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”

or

Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent -Query “Select Size from CacheConfig” | Select Size

Get Configuration Manager Client Cache Size using PowerShell