taskkill with a custom action
how would I run a custom action with taskkill.exe to kill ms runtime c++ process during the uninstall of an app
no sure about how to sequence this
am using wise - execute program from destination
no sure about how to sequence this
am using wise - execute program from destination
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
anonymous_9363
17 years ago
I'd be using a VB Script with WMI calls. Here's one I found in my arsenal (not used personally):
'**********************************************************************************
'* Script Name: StopProcess.vbs
'* Description: Checks for running process and stops it.
'**********************************************************************************
Option Explicit
'Initialisation
'**************
Dim objWsh
Dim strProcessName
strProcessName = "ProcessName.exe"
Set objWsh = CreateObject("WScript.Shell")
'Processing
'**********
fnStopProcess objWsh, strProcessName
Set objWsh = Nothing
'Functions
'*********
Function fnStopProcess (objWsh, strProcessName)
'Variables
'---------
Dim objProcess
Dim objWMIService
Dim colProcessList
Dim strSql
Dim blnProcessRunning
'Initialise boolean
'------------------
blnProcessRunning = False
'Obtain WMI Service
'------------------
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
'Build query
'-----------
strSql = "Select * from Win32_Process Where Name = '" & strProcessName & "'"
Set colProcessList = objWMIService.ExecQuery(strSql)
For Each objProcess In colProcessList
'Process found - stop it
'-----------------------
blnProcessRunning = True
objProcess.Terminate()
Next
Set objProcess = Nothing
Set colProcessList = Nothing
Set objWMIService = Nothing
End Function
'**********************************************************************************
'* Script Name: StopProcess.vbs
'* Description: Checks for running process and stops it.
'**********************************************************************************
Option Explicit
'Initialisation
'**************
Dim objWsh
Dim strProcessName
strProcessName = "ProcessName.exe"
Set objWsh = CreateObject("WScript.Shell")
'Processing
'**********
fnStopProcess objWsh, strProcessName
Set objWsh = Nothing
'Functions
'*********
Function fnStopProcess (objWsh, strProcessName)
'Variables
'---------
Dim objProcess
Dim objWMIService
Dim colProcessList
Dim strSql
Dim blnProcessRunning
'Initialise boolean
'------------------
blnProcessRunning = False
'Obtain WMI Service
'------------------
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
'Build query
'-----------
strSql = "Select * from Win32_Process Where Name = '" & strProcessName & "'"
Set colProcessList = objWMIService.ExecQuery(strSql)
For Each objProcess In colProcessList
'Process found - stop it
'-----------------------
blnProcessRunning = True
objProcess.Terminate()
Next
Set objProcess = Nothing
Set colProcessList = Nothing
Set objWMIService = Nothing
End Function
Posted by:
cygan
17 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.