Solved

Reading Task Manager Processes

Posted on 2008-10-29
4
515 Views
Last Modified: 2012-06-21
I see that there is an extended stored procedure within SQL Server called xp_terminate_process  which will terminate a process running within task manager. Is it possible to read through the process list to see whether a project is running, not by its PID but by its name?

For example, if I were to have a program called TestApp.exe running which then is terminated, I would like SQL Server to fire an email using Database Mail to alert a user that the program is no longer running. I have the rest of the routine worked out, just not the part that actually reads the entries in the process tab of Task Manager.

Any ideas?

Thank you.
0
Comment
Question by:Enhanced Support
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:randy_knight
ID: 22833144
Is this 2005?  I would probably use SSIS and use a VB.NET script to access running processes.  I don't know it fof the top of my head but there has to be an east .NET framework way to check running processes?  

It it's SQL 2000, you could do the same thing in DTS with an ActiveX Script ... would need to use WMI but that's not too hard either.

0
 

Author Comment

by:Enhanced Support
ID: 22833290
The client is actually using MSDE but I can see that this could be useful for other applications in future.

I would have thought that as SQL Server can obviously see the Task Manager entries to kill the task, surely it should be able to query them? The whole point is to monitor when a program is no longer running from within SQL Server itself rather than building another program to act as the monitor.
0
 
LVL 4

Accepted Solution

by:
randy_knight earned 125 total points
ID: 22833607
I'd probably use xp_cmdshell and call a batch file that uses WMI in this case ...
0
 

Author Closing Comment

by:Enhanced Support
ID: 31511211
Thanks, Randy - think that will probably do what we need. I'll google the rest !

Mark
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now