End process from Task Manager using programming?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi experts,

Sometimes there is some "unkilled" processes remained in Task Manager. For
instance, there is a task to generate picture using ASP image scheduled by
SQL job but somehow certain processes like cmd.exe and IExplorer.exe are not
released and cause the SQL job non-stop running.

Even with kill job signal being sent to SQL but the SQL job will not be
cancelled until cmd.exe and IExplorer.exe are manually terminated using Task
Manager. The problem is this action require human attention and quite
irritating. Any way to do the programming (using VB.NET) to check for these
processes which are run under certain user so that can terminate them by code?

Thanks.
 
Just posted this in the other newsgroup for someone the other day.

This should get you started.

'Where textbox1.text = "NOTEPAD" not NOTEPAD.EXE
Dim myProcesses() As Process
Dim myProcess As Process

myProcesses = Process.GetProcessesByName(Trim(TextBox1.Text))
For Each myProcess In myProcesses
myProcess.Kill()
Next

Cheers

Miro
 
Back
Top