I'd like to know whether it is possible to directly find a device's GUID
if I know the BUS / VID and PID (or BUS VEN / DEV) of it
The only option that I have so far is to retrieve all devices withWMI (in my case only usb network devices), get their PNPDeviceID and parse for it.
Is there anything faster? WMI is rather slow and my code doesn't really seem elegant.
Are there options using directly the win32 module?
My current code works for python2 and python3, but as mentioned above.
I manually search through all network devices and parse the PNPDeviceID
c = wmi.WMI()
def find_by(bus, vid, pid):
nw_adapters = (
pnp_string_start = r"%s\VID_%s&PID_%s" % (bus, vid, pid)
for device in nw_adapters:
def get_guid(bus, vid, pid):
device = find_by(bus, vid, pid)
return None if device is None else device.GUID