Trevor Sullivan's Tech Room

Minding the gap between administration and development

SCCM – Changing Client Cache Location

Posted by Trevor Sullivan on 2009/10/05


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 root\ccm\SoftMgmtAgent -Class CacheConfig -ComputerName omxg69cg81d
Write-Host "Current cache location is " $ccmcfg.Location
$ccmcfg.Location = "C:\WINDOWS\SysWow64\CCM\Cache"
$ccmcfg.Put()

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:root\ccm\SoftMgmtAgent:CacheConfig.ConfigKey=""Cache""")
ccmcfg.Location = "C:\Windows\SysWOW64\CCM\Cache"
ccmcfg.Put_()

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

Please leave any questions in the comments section!

Advertisements

4 Responses to “SCCM – Changing Client Cache Location”

  1. Paul said

    Hey I tried the vbscript implementation of this, and its not working on Server 2008 R2. It changes the GUI display, but the cahce stays in the original location and I’ve verified that its still reading/writing to the original location. Any tips?

    • Trevor Sullivan said

      Paul,

      Did you run the script as administrator? Did you make sure to copy the part that restarts the ccmexe service? Have you tried rebooting the 2008 R2 instance?

      Cheers,
      Trevor Sullivan

      • Paul said

        Hey Trevor,

        Thanks for the response… yes, yes and yes are the answers 🙂 I even tried a psexec -s to run as the system account. I’m checking with our SCCM admins (I’m just a lowly Citrix admin) to see if they have any clues. Its probably something specific to our environment, or I’m doing something really silly. I’ll let you know!

  2. Ben said

    Yes Paul, you are a lowly Citrix admin!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: