SCCM – Changing Client Cache Location

Update (2009-10-05 12:30 PM): Thanks to Todd Hemsell, I now know that you have to restart the ccmexec service in order for the change to take effect. I’ve updated the scripts appropriately.

So you’ve got System Center Configuration Manager (SCCM) 2007 in place, and for whatever reason, you’re looking to change the location of the client cache. One method of doing this is to send an e-mail to all your users with instructions on how to change the cache location from the Control Panel applet, right? Well, technically yes, but I’d only suggest doing that if you want more than 5 users to actually do it, much less type the path correctly.

In any event, if you want to script / automate the changing of the SCCM cache location, you can simply use the following PowerShell code as a deployable script:

$ccmcfg = Get-WmiObject -Namespace rootccmSoftMgmtAgent -Class CacheConfig -ComputerName omxg69cg81d
Write-Host "Current cache location is " $ccmcfg.Location
$ccmcfg.Location = "C:WINDOWSSysWow64CCMCache"

Get-Service ccmexec | Stop-Service
Start-Sleep 10
Get-Service ccmexec | Start-Service

In VBscript, it would look something like this:

set ccmcfg = GetObject("winmgmts:rootccmSoftMgmtAgent:CacheConfig.ConfigKey=""Cache""")
ccmcfg.Location = "C:WindowsSysWOW64CCMCache"

set ccmexec = GetObject("winmgmts:rootcimv2:Win32_Service.Name=""ccmexec""")
stopresult = ccmexec.StopService()
wscript.sleep 10000
startresult = ccmexec.StartService()

Please leave any questions in the comments section!