WMI Parent / Child Request PNP_entity

I am currently developing a program to check if a USB device is detected on a specific USB host in C #. I know the PID and VID of both the hub and the slave connected to the hub. I do this with a ManagementObjectSearcher query to get devices:

ManagementObjectSearcher USBSearchQuery = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PnPEntity WHERE DeviceID LIKE \"%VID_17EF&PID_6019%\""); ManagementObjectCollection DeviceCollection = USBSearchQuery.Get(); 

This works great. The ManagementObjectCollection DeviceCollection control contains 2 elements. One HID device and one USB device. When I check with the device manager, I see the elements and can access the Parent property, but it seems that it is impossible to get the parent or child of the object through a WMI request.

I could do this either through the child nodes of the hub or from the parent of the device. Do any of you have an idea how to do this?

+4
source share

All Articles