troubleshooting Question

Cannot clear SMS Cache via script??

Avatar of NBquery
NBquery asked on
Microsoft Server OSVB Script
2 Comments1 Solution813 ViewsLast Modified:
I am trying to clear out the local SMS client cache on several machines, but the VB script I am using doesnt seem to work.  I created a SMS Advertisement to download the package and run locally.  The script I have is:

on error resume next

dim oUIResManager
dim oCache
dim oCacheElement
dim oCacheElements

set oUIResManager = createobject("UIResource.UIResourceMgr")

if oUIResManager is nothing then
      wscript.echo "Couldn't create Resource Manager - quitting"
      wscript.quit
end if

set oCache=oUIResManager.GetCacheInfo()

if oCache is nothing then
      set oUIResManager=nothing
      wscript.echo "Couldn't get cache info - quitting"
      wscript.quit
end if

set oCacheElements=oCache.GetCacheElements

for each oCacheElement in oCacheElements
oCache.DeleteCacheElement(oCacheElement.CacheElementID)
next

set oCacheElements=nothing
set oUIResManager=nothing
set oCache=nothing


I save the above in a VB fileclearcache2.vbs and set the CMD to run on the local client as:

cscript.exe clearcache2.vbs

Can anyone see why it might be failing?  This should be pretty easy I thought&..
ASKER CERTIFIED SOLUTION
Hayes Jupe
IT Director
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros