Your company's ad could live here and reach over 50,000 people a month!

Share This Post

Change SCCM Cache Size Package

I modified the vbs provided by Don Hite (VBS Script To Change A Remote SMS/ConfigMgr Clients Cache Size) so that I could push it out to multiple machines.

Usage: cscript.exe sccmcache.vbs <New Cache Size in MB>

VBScript:

 

args = WScript.Arguments.Count
If args < 1 then
  WScript.Echo "usage: sccmcache.vbs [New Cache Size] "
  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 Cache 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 "Cache Size Changed"

Share This Post

I am an SOE Engineer working mainly with SCCM. I hope some of my blogs can help others deal with problems I have come across.

Leave a Reply