dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Monitor processes with WMI in .NET

  1. #1
    Join Date
    Mar 2005
    Posts
    52

    Monitor processes with WMI in .NET

    Hello everyone,
    i believe the system.management namespace can be used to monitor processes for instance determine processes that exceed 80% cpu utilization and then terminate them.

    I wish to write an application which can monitor other applications to determine whether they are started,stopped, idling or hanging.

    Can anyone provide me with related links or articles for this particular problem?

    Thanks a lot....

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    I don't know whether this has all the info you're looking for but it should help you get started:

    Win32_Process

    Code:
     
       Public Sub GetProcessInfo()
    
            Dim wmiquery As WqlObjectQuery = New WqlObjectQuery("SELECT * FROM Win32_Process")
            Dim wmifind As ManagementObjectSearcher = New ManagementObjectSearcher(wmiquery)
    
            Dim mobj As ManagementObject
            For Each mobj In wmifind.Get()
                Console.WriteLine("Description: " + mobj("Description"))
            Next
    
        End Sub
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Mar 2005
    Posts
    52
    Ok thanks. I have looked through the article however i believe i want to instrument an application meaning i want to track the current health and performance characteristics of the application. Maybe the System.Management.Instrumentation namespace can achieve it but i do not have any idea to start. Can you provide me with some guidance in this problem?Thanks a lot

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    I'll have to dig through the documentation a bit since I don't have a full example. I won't be in the forums much over the next couple of days but I'll see what I can come up with.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Mar 2005
    Posts
    52
    I have come across an article which is quite useful
    url:http://www.csharphelp.com/archives3/archive584.html

    Hope you contribute some articles or examples to me.Thanks for your help.
    I await your return to your forum.

  6. #6
    Join Date
    Jun 2004
    Posts
    93
    You may want to try the following:

    1. Use the Process class to get a list of running processes and their info (Process.GetProcesses)

    2. Use the PerformanceCounter class to retrieve statistics (CPU usage, memory, etc) for the processes.

    If you do not know about performance counters, play around with the Windows Performance Monitor to get a feel for what it can do. The PerformanceCounter class will then make sense.

  7. #7
    Join Date
    May 2005
    Posts
    8
    Hi guys, I need similar issue, need look windows name the all need process launched.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center