Asked By EricAtAES
29-Jan-10 11:57 AM

Hi,
In my application, I need to detect whether a USB device is physically
connected to the local machine, or if it is connected to a remote machine and
made available locally by way of software such as USB Over Network.
I thought maybe I could use WMI and loop through the connected USB devices,
search for the name of the device I am checking, and then inspect some
property of that device to try to detect whether it is physically located on
my computer.
I do not know enough about WMI to know how to accomplish this, or if it can
even be accomplished. Here is what I have found so far:
Using C#,
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT *
FROM Win32_USBController");
foreach (ManagementObject wmi_USBDevice in searcher.Get())
{
// Check here
}
When I have the device connected locally, all of the objects returned by the
above query have a name similar to "Intel(R) ICH8 Family USB2 Enhanced Host
Controller - 283A". When I have the device connected to a remote machine and
made available to me using USB Over Network, one of the devices returns a
name that is easily identifiable to me as the name of the device I am looking
for.
What I am wondering is, is this sufficient? If I find the device name, do I
know it is actually located on a remote machine? It does not "feel" right.
If anyone has done something like this and has any suggestions, it would
help me out a lot. Thanks in advance.
-Eric