WIN32 - get the GUID of a Network Device

Tim Roberts timr at probo.com
Mon Apr 26 23:07:30 CEST 2010


Tim Golden wrote:
> On 26/04/2010 09:49, Richard Lamboj wrote:
>> thanks for your response. No, i don't mean the MAC Address. I mean
>> the GUID ->
>> Sample: {1E2428C1-9F2C-48D7-AB53-3229DFB7E217}
>>
>> I want to change TcpAckFrequency and TcpDelTicks of a Network
>> Interface. I Try
>> to change it over the Registry, but maybe there is another way?
>
> OK; I'm going to hope that Tim Roberts or someone equally
> knowledgeable can
> kick in here as devices really isn't my area. However this looks like
> it *might*
> be doing what you want:
>
> <code>
> import wmi
>
> for nic in c.Win32_NetworkAdapter (MACAddress=i.MACAddress):
>   for pnp in c.Win32_PNPEntity (DeviceID=nic.PNPDeviceID):
>     print pnp.Caption, "=>", pnp.ClassGuid
> </code>

No, the PnP class GUID is the "Class" line from the top of the INF
file.  That will be the same for all network cards.

You can look up the network interface GUID in the registry, in
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards.  There's
one subkey for each interface, containing a Description and a
ServiceName.  The ServiceName is the interface GUID.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.




More information about the Python-list mailing list