VBS Script To Change A Remote SMS 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.


For more information see my post entitled: The SMS Advanced Client Temporary Program Download Folder Cache here:




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.


VBS Script:


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"



Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Service Where Name = 'CCMExec'")


For Each objItem in colItems


Wscript.Sleep 10000




MsgBox "Done"


Published Saturday, March 24, 2007 10:40 AM by dhite
Filed under:


No Comments