简体   繁体   English

检测网络计算机上的USB设备C#

[英]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. 我试图找出什么USB设备插入网络计算机,如果可能的话返回像设备管理器中的列表。

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? 我将检查网络上的所有计算机,以查询是否插入了USB记忆棒来找到该设备,因此可能检测到它创建的驱动器号?

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 我试图使用管理员共享C $,但是这不起作用

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. 如果要查询远程计算机是否插入了哪些设备,则可以访问该计算机上的Windows Management Instrumentation服务。 You will require administrator rights to do this though. 但是,您需要管理员权限才能执行此操作。

The WMI service provides meta data about the machine it's running on. WMI服务提供有关正在运行的计算机的元数据。

More info about accessing WMI can be found here: https://msdn.microsoft.com/en-us/library/aa389290(v=vs.85).aspx 有关访问WMI的更多信息,请访问: https//msdn.microsoft.com/en-us/library/aa389290(v = vs.85).aspx

It also accepts queries not too dissimilar to SQL. 它还接受与SQL不太相似的查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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