How to Change the CCMCache Size Using Powershell

I’ve learnt a lot about SCCM and Powershell since my last post that detailed changing the cache size using VBScript and as such, I thought it was about time I retired my old application and replaced it with a new and improved Powershell version of the same thing. So here’s how I did it using Powershell….

1 – The first thing I did was write a Powershell script to do the task in hand.  When calling the script from the command line, you can use the parameter -CacheSize followed by the number in MB that you want to size it to.  If you leave this parameter out then it defaults to setting it to 10GB.  By including this parameter in the script we now give ourselves the ability of using one application with multiple deployment types – awesome!   The script will also write to the local computers registry which I use not only for the detection rule but also it’s nice to be able to pull this information into a nice report if needed at a later stage.

Having said all of that, you can find the script here in my Github repo, it’s called: SetCCMCacheSize.ps1

If you wish to change the default setting of 10GB  – then you will need to adjust the figure (in MB) on line 4 that reads:

$CacheSize = 10240

And finally, you may wish to adjust where it writes the information into the registry by editing lines: 49:

New-Item -Path HKLM:\System\CSU\CCMCache -force

and line 52:

New-ItemProperty -path HKLM:\System\CSU\CCMCache -name 'SizeInMB' -Value $Size -PropertyType string -force

Once that’s done, simply save the .ps1 file to where ever you would normally store your apps\scripts that you distribute, on your Configuration Manager server.

2 – Now to create the Application:

a: In the Configuration Manager Console, select Create Application as you would normally:



b: Select ‘Manually specify the information’:

b - Manually Specify The Application Information


c: Complete the fields you are interested in on the General Information screen:

c - General Information


d: I never completed anything for the Application Catalog as I will be deploying this to devices, however, feel free to season to taste:

d - Application Catalog


e: Click the ‘Add’ button to add a new deployment type:

e - Deployment Types


f: Select ‘Script Installer’ and ‘Manually specify the deployment type information’:

f - New Deployment type - Manual

g: Give the deployment type a meaningful name.  In my example, I will be setting the cache size to 6GB:

g - Dep Type - General Information


h: In the content Location field, Browse to the folder where you stored your powershell script and for the installation program type:

powershell -ExecutionPolicy Bypass -file .\SetCCMCacheSize.ps1 -cachesize 6144

If you want it set to 10GB then you can leave off the parameter -cachsize 6144 entirely.  Likewise if you wanted it set to a different figure, say 8GB then you would use the following:

powershell -ExecutionPolicy Bypass -file .\SetCCMCacheSize.ps1 -cachesize 8192

h - Content


i: Click the ‘Add Clause’ button:

i - Add Clause

j: Complete the settings as shown in my screenshot below however, if you have changed the script to write to a different part of the registry then you will need to reflect that change here.  Also, make sure that the ‘Value’ is set to the same figure that you use as the parameter in step h (above) eg it must match the size that you are setting the cache to.  Continuing my example, I am setting it to 6GB so the value is: 6144

j - The Detection Rule


k: Here’s the result of your detection rule:

k - The rule


l: For the user experience, I will be deploying to devices and so I have completed the fields as shown below in my screenshot:

L - User Experience


m: Click the ‘Add’ button to add some system requirements for this deployment type.

m - Reqs


n:  I just chose Windows 7 SP1 x64 but your needs may differ:

n - the reqs


o: The result of your requirements:

o - Final reqs


p: If you want to add any dependencies then do it here.  I chose not to:

p - deps


q: Close the summary screen:

q - summary1


r:  The Deployment Type Wizard summary:

r - completion


s: Here’s where you can add another deployment type.  You could repeat the above process and have multiple different cache sizes depending on the requirements.  Cool stuff! I simply clicked ‘Next’ here for this example though:

s - deptypes


t: You are presented with a Summary:

t - summary2


u: And you’re done!

u - Finished


3.  Here’s what it looks like in Config Manager:

v - results

4.  Now you simply need to upload this to your distribution point and deploy to a computer collection.  I made mine a required deployment.

5.  Here’s what you get in the registry on the computer that has successfully had it’s cache size changed:

w - RegResults

6. And the proof!

x - configMgrClient


  1. does it need to be in the ‘HKLM\System\CSU’ folder? if this were to be changed to a different folder would that be ok?

  2. Doesn’t appear to work for me. Get an error in the Application not discovered …. AppDiscovery.log that it did not detect app deployment type

    • You’ve made a mistake somewhere. If you have adjusted the registry location you need to make sure that you have reflected your changes throughout, including checking for typo’s everywhere which is what I suspect the issue is. Not only do you need to adjust the script but also your detection rule as mentioned in step j in my post. Try the script ‘as is’ without modifications on a test VM so you can see the expected results.

Leave a Reply

Your email address will not be published.