We help IT Professionals succeed at work.
Get Started

Cannot clear SMS Cache via script??

NBquery
NBquery asked
on
812 Views
Last Modified: 2013-11-21
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&..
Comment
Watch Question
IT Director
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE