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
PnPID = obj.PnPDeviceID
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
Сейчас этот форум просматривают: AhrefsBot и гости: 102