views:

52

answers:

3

I need to start a monitor on some machines to find out which processes are locking it. So what I would like is logging about the same information you can find on the Task Manager about each executing process.
So far I can have the Processor Time information with the C# Process Class, but I would also like to know how much memory it is using. Also would be very useful to see if a given application or a process is " Not Responding".
Any ideas about how to get all that info. ( might the System.Events help as well?)

A: 

Take a look here: Customized Task Manager in .NET using C# and Windows Forms

Rubens Farias
A: 

I think your best bet is to use WMI and get all the instances of the Win32_Process class. You can get all of the Win32_Process instances using the ManagementObjectSearcher.

Nick
+2  A: 

I agree with Nick, WMI is your best bet for detailed process info.

But there is also something that you may be interested in, Powershell (ships with Windows 7 and available as download for other OS's) not only supports WMI but presents the WMI artifacts as Objects that you can subsuqently run linq queries over - pipeline into other powershell calls etc, its also completely programable and/or scriptable, it's very cool tech, well worth learning....but...it's a reasonable investment of time to learn.

Power shell Msdn site

Tim Jarvis
Thanks for The Powershell advice. I've seen it before and it might be really powerfull. WMI is actually my best choice. So let's give you and up vote but Nick get's the check. Thanks!!!!
jmayor