Wednesday 11 March 2015

Taskkill through VBScript - Advance Application Packaging


During uninstallation of some application some background task must be killed before proceeding to uninstall.

In such scenaros following code can be embeded in CustomAction,


Option Explicit
On Error Resume Next

Dim strProcessName, strCmd

Dim WshShell

strProcessName = "RemoteVault.exe"

strCmd = "CMd /C TASKKILL /IM " & strProcessName & " /F /T"                  
Set WshShell = CreateObject("WScript.Shell")                                                    
WshShell.Run strCmd , 0, True                                                                                   
Set WshShell = Nothing


In above line of code RemoteVault.exe is the background running process/task.

Thank you for reading.

1 comment:

  1. you are giving all real time scenario examples... nice stuff... keep posting more....... thanks :-)

    ReplyDelete