End process from Task Manager using programming?

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.
 
M

Miro

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
 

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

Top