/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 16 years ago
Red Belt
0
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
Posted by: cygan 16 years ago
Fifth Degree Brown Belt
0
thanks a lot vbscab your script works 100 and 1 percent

cheers for that
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ