Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script syntax to find the total SMS Cache on a PC

Status
Not open for further replies.

Pyro777

MIS
Jul 14, 2006
47
US
I have not been able to find anything in the registry about the SMS cache on my customers PCs. Any help would be appreciated !!!
 
I can't seem to find anything that specifically states a path to the Cache location but it appears to always be under the SMS path location. The following code works on my PC:

Code:
Dim strKeyPath, strValueName, strComputer, objRegistry, strValue
Dim objFSO, objFolder, strFolderSize

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\SMS\Client\Configuration\Client Properties"
strValueName = "Local SMS Path"

Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strValue & "Cache")

strFolderSize = UCase(objFolder.Path) & " uses " & objFolder.size & " bytes."

Wscript.echo strFolderSize

Set objRegistry = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
 
If you're running a script locally you can use the SMS client object

UIResource.UIResourceMgr

You can find examples in the SMS SDK.

You can probably use wbemtest to explore the values available through WMI since SMS has its own classes it registers there.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Might be helpful to you....

Code:
Option Explicit

Dim objSMSClient : Set objSMSClient = CreateObject("UIResource.UIResourceMgr")
Dim objSMSCache : Set objSMSCache = objSMSClient.GetCacheInfo()
WScript.Echo objSMSCache.Location
WScript.Echo objSMSCache.TotalSize
WScript.Echo objSMSCache.FreeSize
WScript.Echo objSMSCache.MaxCacheDuration
WScript.Echo objSMSCache.ReservedSize

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Info using WMI

Code:
Option Explicit

Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\.\root\ccm\softmgmtagent")
Dim colCacheInfo : Set colCacheInfo = objWMIService.ExecQuery("SELECT * FROM CacheConfig")
Dim objCacheInfo, objProperty
For Each objCacheInfo In colCacheInfo
	WScript.Echo objCacheInfo.InUse
	WScript.Echo objCacheInfo.Location
	WScript.Echo objCacheInfo.Size
Next

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top