Set schedule Kill a certain EXE in Task Manager

  • Thread starter Thread starter Ivan Kan
  • Start date Start date
I

Ivan Kan

Is that possible to use VB Script to kill a specific EXE in Task Manager?

Ivan
 
Ivan said:
Is that possible to use VB Script to kill a specific EXE in Task Manager?

Hi

Here is a vbscript using WMI to terminate iexplore.exe


sComputer = "." ' use "." for local computer
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\cimv2")

Set colProcessList = oWmi.ExecQuery _
("Select * from Win32_Process Where Name = 'iexplore.exe'")

For Each oProcess in colProcessList
oProcess.Terminate()
Next


Note that WMI's Terminate method sometimes isn't able to kill tasks that
command line task kill utilities can.

Here is a couple of command line utilities:

A)
The Microsoft command line tool kill.exe.

Kill.exe is in the Win2k Support Tools found on the Win2k CD,
\Support\Tools\Suptools.msi, or for the latest version of
Support Tools (should work on non-SP4 computers as well):
http://www.microsoft.com/windows2000/downloads/servicepacks/sp4/supporttools.asp

(Taskkill.exe comes build in with WinXP Pro)


B)
The command line tool PsKill.exe in the free PsTools suite at
http://www.sysinternals.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top