Avatar of NBquery
NBquery
 asked on

Cannot clear SMS Cache via script??

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&..
Microsoft Server OSVB Script

Avatar of undefined
Last Comment
NBquery

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Hayes Jupe

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
NBquery

ASKER
HayesJuple,

Thanks!  We had to modify the script a bit but I was ianlly able to clear out the cache.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck