getting windows processes list

Grant Griffin Grant_member at
Tue Jun 4 18:14:02 CEST 2002

In article <mailman.1023145566.5739.python-list at>, "Mike says...
>If I'm not mistaken, win32pdh should be able to get the information 
>using a process counter.  WSH might also be able to get at it.
>PS: Grant, your email address bounces.

Thanks, Mike (and all!)--win32pdh led me to the answer.

My purpose was to determine when a NetMeeting session had ended.  The problem
with NetMeeting is that program control returns after just a few seconds even if
NetMeeting is still running.  So, recognizing that Microsoft typically provides
more than one way to skin its cats, I decided to use NetMeeting's process name
to determine if it was running.

Based on Mike's tip, I hunted through win32pdh, which led me to win32pdhutil.  I
adapted the routine below from win32pdhutil's "GetPerformanceAttributes" to get
a list of the names of all processes; if "conf" (the secret code for
"NetMeeting") appears in the list, NetMeeting is presumed to still be running.

god-bless-microsoft-for-making-everything-so-complicated-<wink>-ly y'rs,

def GetProcessNames(object="Process", counter="ID Process",
                    format=win32pdh.PDH_FMT_LONG, machine=None,
    if bRefresh: # PDH docs say this is how you do a refresh.
        win32pdh.EnumObjects(None, machine, 0, 1)
    items, names = win32pdh.EnumObjectItems(None, None, object, -1)
    return names


Grant R. Griffin                                           g2 at
Publisher of dspGuru                     
Iowegian International Corporation      

More information about the Python-list mailing list