Setting the SMSCacheSize During OSD Task Sequence (PowerShell)
So you just want to configure the cache size of the Configuration Manager agent to something else other than the default size of 5120MB for whatever reason. Easy right? Since the cache size is set during the installation of the ConfigMgr client you go to the “Setup Windows and ConfigMgr” task and just add the SMSCACHESIZE parameter as the installation properties and it’ll work right? Not so fast.
The installation properties will only work if you’re installing the ConfigMgr client and will not work if you’re re-installing the client. So why this might not work in your task sequence? Really it is because if you’ve got the ConfigMgr client installed in your reference image (which is pretty common when creating a sysprep’ed reference image to get the things like core apps or software updates installed), then running the “Setup Windows and ConfigMgr” task in your task sequence is actually re-installing the ConfigMgr client and that’s why this method wouldn’t work.
So how do you work around it? Run a PowerShell script. Below is the contents of the script. Copy and paste it into Notepad and save it as a .ps1 file. Change the $Cache.size to whatever you want in MB.
$Cache = Get-WmiObject -namespace root\ccm\SoftMgmtAgent -class CacheConfig
$Cache.size = 20480
$Cache.InUse = "True"
After you create a package for your PowerShell script, it is time to add it as a task in your deployment task sequence. So I use the Run PowerShell Script task and reference the package I’ve just created for it. Obviously the Script name is the file name I saved the above content as. Set the PowerShell execution policy to “Bypass”. You would want to run this script after the “Setup Windows and ConfigMgr” task but anything lower will work as well like how I’ve done it. And that should be it!