Increasing the ConfigMgr Client Cache Size beyond 99999 MB

Few people knows that the ConfigMgr Client Cache has a default limit of 99999 MB, or 97.6 GB. That's when using native ConfigMgr Client Settings or the UIResource.UIResourceMgr COM object on the client that is.

TL;DR: If you don't mind a healthy dose of WMI, you can increase the size beyond 99999 MB.

Credits: Thanks to Maik Koster for the tip on using WMI.

Note: Yes, it's a known bug since 2018, but due to the current maintenance mode of ConfigMgr, it's not likely to get fixed unless it's a significant impact to your organization, and you'll file bug for it.

Background

When using large pre-caching jobs for either Peer Cache, BranchCache or other needs there are times where you need to bump up the ConfigMgr Client Cache Size significantly (the default size is 5 GB).

It's common to use the ConfigMgr client settings for this, and below is an example of setting the cache to 64 GB or 50 percent of the disk, whatever limit is met first.

Configuring Client Settings in ConfigMgr.

Another, more dynamic option, is to have a ConfigMgr Baseline that set the cache size via PowerShell Script. Using a script allows you to dynamically change the cache size based on for example current free disk space (avoiding relying on hardware inventory). Here is a simple example:

# Script that set ConfigMgr Client Cache Size depending on Free Disk Space

Function Get-FreeSystemDiskspace {
    # Get the free space from WMI and return as percent
    $SystemDrive = Get-WmiObject Win32_LogicalDisk  -Filter "DeviceID='$env:SystemDrive'"
    [int64]$ReturnVal = $Systemdrive.FreeSpace
    return $ReturnVal
}

$FreeDiskSpaceInMB = [int]((Get-FreeSystemDiskspace)/1MB)

switch($FreeDiskSpaceInMB){
    {$_ -lt 20480}{$NewCacheSize = 6144 } 
    {$_ -ge 20480 -and $_ -lt 49600}{$NewCacheSize = 10240} 
    {$_ -ge 49600}{$NewCacheSize = 20480} 
    default{$NewCacheSize = ""}
}

If ($NewCacheSize){
    $UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr
    $Cache = $UIResourceMgr.GetCacheInfo()
    $Cache.TotalSize = $NewCacheSize
}

Workaround using Task Sequences

If your goal is to just download large content, you can completely skip the ConfigMgr Client Cache by using a Task Sequence, and configure a Download Package Content action to download to a custom path. Here is an example:

Note: Make sure Not to configure the deployment to "Download all content locally before starting task sequence", that will force the use of the cache which we are avoiding in this example.

Task Sequence with a Download Package Content action.

Configure Client Cache Size via WMI

If you do want to use the ConfigMgr Client Cache, for example for a large Peer Cache job, or really any scenario where you want to use the ConfigMgr Client Cache, you can set it via WMI. Below is an example setting the cache size to 128 GB:

Note: When setting the cache size via WMI you must excluded these devices from any Client Setting or Baseline configuring the cache size. Also, when using WMI, the ConfigMgr client service must be restarted for the change to take effect.

# Parameters
$SplattingWMI = @{
    NameSpace = "ROOT\CCM\SoftMgmtAgent"
    Class     = "CacheConfig"
}

# Set the Cache Size
$Cache = Get-WmiObject @SplattingWMI
$Cache.Size = 128000
$Cache.Put()

# Restart the ConfigMgr Client Service (requirement when using WMI)
Get-Service -Name CcmExec | Restart-Service
About the author

Johan Arwidmark

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

>