简体   繁体   中英

Detect USB devices on a network computer C#

I am trying to find out what USB devices are plugged into a network computer, if possible returning a list like in device manager.

I am going to be checking all the computers on the network to query if a USB memory stick is inserted to locate that device, so it is may be possible to detect the drive letter it creates?

alternatively the device also creates a disk drive when it is plug in which could be located also.

i have tried to use the admin share C$ like below however this does not work

Directory.GetDirectories(@"\\192.168.0.112\C$) 

any suggestions on this topic would be helpful.

If you want to query a remote computer as to what devices are plugged in then you can access the Windows Management Instrumentation service on that machine. You will require administrator rights to do this though.

The WMI service provides meta data about the machine it's running on.

More info about accessing WMI can be found here: https://msdn.microsoft.com/en-us/library/aa389290(v=vs.85).aspx

It also accepts queries not too dissimilar to SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM