10 Nov 2011 @ 10:06 AM 

Last few weeks I’ve been implementing a MED-V solution at a customer.
Since this customer is using SCCM for deployment of their client OS and applications, they wanted me to deploy the MED-V solution by using SCCM. This went without any hickups, with one exception.

By default the SCCM Client cache is set to 5GB. My problem with this was that my MED-V image was about 17GB!
Since the size of the client cache can only be configured when you install the SCCM client on the device, and can not be changed by a simple registry value, I started scripting.

This is what I came up with… and found it extremely useful since I had to change the size of the client cache in the entire environment!

args = WScript.Arguments.Count
If args < 1 then
  WScript.Echo "usage: sccmcache.vbs [New size in MB] "
  WScript.Quit
end If
strComputer = "."
intCacheSize = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/ccm/SoftMgmtAgent")
Set colItems = objWMIService.ExecQuery("Select * from CacheConfig")
For Each objItem in colItems
  objItem.Size = intCacheSize
  objItem.Put_ 0
  wscript.echo "The SCCM cache size on " & UCase(strComputer) & " located at " & objItem.Location & " will be changed to: " & objItem.Size & " MB"
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service Where Name = ‘CCMExec’")
For Each objItem in colItems
  objItem.StopService(strServiceName)
  Wscript.Sleep 10000
  objItem.StartService(strServiceName)
Next
wscript.echo "The SCCM cache size on " & UCase(strComputer) & " located at " & objItem.Location & " has been changed to: " & objItem.Size & " MB"

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 10 Nov 2011 @ 10:06 AM

EmailPermalink
Tags
Categories: Microsoft, SCCM, Script


  • Tracey Bailey

    Hi, I have the same problem.
    I have about 300 computers I would like to change the cache size on.
    Trying to run this script, and I get an err 0×80041017 at line 17 char 1.
    Trying to debug, but I’m not much of a scripter, so I doubt I’ll figure it out.

  • http://www.jeffwouters.nl Jeff Wouters

    Hi Tracy,
    I’ve just tested the script in my environment and it worked… so instead of troubleshooting you could go a step further and use PowerShell instead of the VBScript I provided.
    John Grenfell wrote a PowerShell script to change the SCCM Client Cache size and published it in the Microsoft Script Library: http://gallery.technet.microsoft.com/scriptcenter/7a087f21-18a1-446a-a33c-38b187ea1716


Get Adobe Flash player
 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 164
  • Comments » 150
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.