Jump to content


ibrafe

CM12 Vbscript detection method

Recommended Posts

Hi

 

I have been tasked to deploy application to users machines via sccm 2012. One of the requirements is that when the application is installed, We have to delete it from the ccmcache. The following scripts does the job but as you can see but the detection method is making loose my hair. It works on the 1st deployment but if I deploy another application and use the same script. It detects sccmcachecleaner folder and flags it as a success hense nothing is installed

 

My application is configured to with 2 deployment types with priority 1 as the script and priority 2 with the actual app. The 1st deployment type is has a dependency to the 2nd deployment type.

 

 

The software we are deploying are license restricted and we don't want people digging through the ccmcache to steal the applications. Any ideas will help

 

 

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

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\Windows\Temp\sccmcachecleaner")

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.