piektdiena, 2014. gada 30. maijs

VBS script in SCCM to delete file

Some applications does not remove link after uninstall. Application is uninstalled but link remains pointing to nowhere. I need it to deploy via SCCM 2012. Investigations show that cmd files wont work so I made it in vbs. Here is my script  file as far as I search the sctipts I found does not work for me so I put together vbs script if  file exists, delete it.
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("C:\Users\Public\Desktop\E-ME.lnk") Then
   fso.DeleteFile("C:\Users\Public\Desktop\E-ME.lnk")
Else WScript.Quit 
End If


It has to be run with proper command . You can test it in elevated command prompt. 
Working locally does not mean a lot, you need to test deployment too. After some experiments I discovered You have to modify Command line adding cscript, dont know what SCCM do behind scene but this line works.

I deployed it as another deployment to the same collection. You can put it together in one package but if you have no previous versions, you dont need to remove link.


Nav komentāru:

Ierakstīt komentāru