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

Share This Post

VBS Script To Change A Remote SMS/ConfigMgr Clients Cache Size

This VBS script will take a local or remote machine name from an input box and then will prompt you to enter a Cache size in MB that you want to change the Cache size to. The script will then stop and then start the SMS Agent Host by Name (CCMExec) to apply the change without the need to restart the service manually as is required when modifying the cache.

Note: The Put method (Put_) is designed to be used when you either create or update a WMI instance or a class object and writes the changes to the specified WMI repository.

VBScript:

 

strComputer = InputBox ("Enter Machine Name")
intCacheSize = InputBox ("Enter New Cache Size (MB)")
 
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
 
MsgBox "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
 
MsgBox "Done"

Share This Post

Don Hite began writing as a columnist for Rod Trent on SWYNK.Com (Now Enterpriseitplanet.Com) in the winter of 1999. In January of 2002 he co-founded the Kansas City Regional Systems Management Users Group (KCRSMUG) along with Janis Keim. Don is the eldest of four children and was born in the Army hospital at Wurzburg Germany in November of 1957. After living in Bad Kissingen Germany for the first few years of his life the Hite family moved back to the United States after his father retired from the army when Don was still in kaki army diapers. Educated by trade as a commercial master electrician Don made the career change from terminating Copper Conductor cable to terminating Ethernet cable in the early 1990’s. Don is married and lives on a farm in rural Kingsville Missouri with his wife Virginia (Ginny) and has a Son Lee, Stepdaughter Lisa and an 11 year old grandson named Blake.

Leave a Reply