View Single Post
 
Old 01-01-2017, 02:42 AM
SABJANTA SABJANTA is offline
Newcomer
 
Join Date: Apr 2008
Posts: 1
Default

Quote:
Originally Posted by George7a View Post
HI,



Code:
dim obj, objs, buf, PnPID ' Get the PnPDevice ID Set objs = GetObject("winmgmts:").InstancesOf("Win32_DiskDrive") for each obj in objs if obj.InterfaceType = "USB" then 'buf = "Model: " & obj.Model & vbcr 'buf = buf & "PnP Device ID: " & obj.PnPDeviceID PnPID = obj.PnPDeviceID 'msgbox(buf) end if next ' fix up the PnPDevice ID to make it suitable for comparing against the Association PnPID = replace(PnPID, "", "\") & chr(34) ' Use WMI associations to pair up USBContoller and PnPEntity Set objs = GetObject("winmgmts:").InstancesOf("Win32_USBControllerDevice") for each obj in objs if right(obj.Dependent, len(PnPID)) = PnPID then msgbox(PnPID & vbcr & obj.Dependent & vbcr & obj.Antecedent) end if next
I hope it helps,

- George

Thanks
Reply With Quote