Re: Kill an Application via Application Name

Tech-Archive recommends: Fix windows errors by optimizing your registry



On 3 Aug 2006 03:09:47 -0700, rossc@xxxxxxxxxxxxx wrote:

Hi Guys

I have some very bad software from a third party that is being phased
out. Unfortuneately not yet! when it runs on my server it creates an
alert box with a C++ error, though only intermittently. I need to kill
these each time it does.

My problem is that I cannot just get the process name and kill it as we
have some genuine processes running under this name

I can identify the error alert under the task manager appplications
tab, and ideally that would be the way to determine which process to
kill

Any ideas

Thanks in advance
Ross


I use the below to kill running applications. This setup will
kill running instances of notepad.exe.

======================================

Set objArgs = WScript.Arguments
processEXE = "notepad.exe"
'processEXE = objArgs(0)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& "." & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & processEXE & "'"
)
For Each objProcess in colProcess
objProcess.Terminate()
next
wscript.quit

.



Relevant Pages

  • Re: kill a running process with wbscript
    ... I use the below via a batch file or other programs to kill ... running processes. ... Set objArgs = WScript.Arguments ... Set colProcess = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)
  • Re: Kill an Application via Application Name
    ... The 4NT solution I suggested will kill a "window". ... I use the below to kill running applications. ... Set objArgs = WScript.Arguments ... Set colProcess = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)
  • Re: Kill an Application via Application Name
    ... I need to kill ... I use the below to kill running applications. ... Set objArgs = WScript.Arguments ... Set colProcess = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)