[python-win32] Fetching network interface instance names
Chris Miles
miles.chris at gmail.com
Sun Jul 24 23:45:08 CEST 2005
Hi, I am querying win32pdh to fetch statistics from each network
interface on the machine. I am able to fetch the stats I need, using
the code below, from each network interface, provided I already know
the network interface instance name (eg: intf below).
My Q is: how can I programmatically find out what the network
interface instance names are?
I can see the instance names manually from the GUI using
win32pdhutil.browse() but that doesn't help my program do it.
>>> intf = 'Intel[R] PRO_100 Network Connection - Packet Scheduler
Miniport'
>>> import win32pdh
>>> hq = win32pdh.OpenQuery()
>>> cp = win32pdh.MakeCounterPath( (None, 'Network Interface', intf,
None, -1, 'Bytes Sent/sec') )
>>> hc = win32pdh.AddCounter( hq, cp )
>>> type,val = win32pdh.GetFormattedCounterValue( hc,
win32pdh.PDH_FMT_LONG )
>>> type
272696320
>>> val
0
Cheers,
Chris
--
Chris Miles
http://chrismiles.info/
More information about the Python-win32
mailing list