In the past I posted how to configure or clear the SCCM client cache using Powershell scripts, but that method required a separate script for each cache size you might want to set. This new script allows on-the-fly modification of the CCM Cache from a task sequence using a single SCCM package containing this new Powershell script.
To use this script, you will need to create a package in SCCM with the source contents containing this script. You do not need to create a program for the package. Make sure the package can be used by task sequences without being deployed. After distributing the package, just call it from a task sequence using a “Run Command Line” step referencing the package.
Assuming you save the script as “sccmCache.ps1”, any of these usage examples will work:
1 2 3 4 5 6 |
powershell -executionpolicy bypass -file sccmCache.ps1 -cacheSize 5120 -clearCache yes powershell -executionpolicy bypass -file sccmCache.ps1 5120 clear powershell -executionpolicy bypass -file sccmCache.ps1 -cacheSize 5120 powershell -executionpolicy bypass -file sccmCache.ps1 5120 powershell -executionpolicy bypass -file sccmCache.ps1 -clearCache yes powershell -executionpolicy bypass -file sccmCache.ps1 clear |
And here is the Powershell script: