简体   繁体   English

如何通过Windows命令提示符或PowerShell获取USB设备名称

[英]How to get USB device name through windows Command Prompt or PowerShell

I am trying to get the USB device name that is displayed in the Control Panel>Hardware>Device and Printers eg.QEMU USB keyboard here: 我正在尝试获取在控制面板>硬件>设备和打印机中显示的USB设备名称,例如QEMU USB键盘: QEMU USB键盘

I am not sure if this can be done. 我不确定是否可以做到。 I have tried using both: 我试过同时使用:

  1. wmic path Win32_USBControllerDevice get Dependent | find "USB"
  2. gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Sort Manufacturer,Description,DeviceID | Ft -GroupBy Manufacturer Description,Service,DeviceID

But I can not get it. 但是我不明白。 Any ideas? 有任何想法吗? Thanks. 谢谢。

Getting the Printers is pretty simple: 获取打印机非常简单:

Get-Printer | select Name

Devices is trickier, and querying your USBController device probably isn't the right way. 设备比较棘手,查询USBController设备可能不是正确的方法。

I can query Win32_PnpEntity and get much closer, but why when Get-PnpDevice is much easier and looks to be about the same results. 我可以查询Win32_PnpEntity并获得更近的距离,但是为什么当Get-PnpDevice变得更容易并且看起来几乎是相同的结果时。

Additionally I can pipe that to Get-PnpDeviceProperty 另外,我可以将其通过管道传递到Get-PnpDeviceProperty

Get-pnpdevice | ForEach-Object { Get-PnpDeviceProperty -InstanceId $_.InstanceId  | select Data}

and try to figure it out from there. 并尝试从那里弄清楚。

I don't think there is anything provided to give you easy access to the friendly device names. 我认为没有提供任何可让您轻松访问友好设备名称的内容。 It might be easier to use PowerShell to search the registry for stored values. 使用PowerShell在注册表中搜索存储的值可能会更容易。

Lastly, I was only able to get as close as something that looked like this: 最后,我只能接近如下所示的内容:

{D781FE0F-49E3-5FFD-BC34-A48286BFE47A}
Generic PnP Monitor
DISPLAY\DEL4090\1&8713BCA&0&UID0
ROOT\BasicDisplay\0000
False
{D781FE0F-49E3-5FFD-BC34-A48286BFE47A}
False
False
False
False
False
3
Generic Monitor
monitor.inf:*PNP09FF,PnPMonitor.Install
0
monitor.inf:91d2a0f3f5cc9ebd:PnPMonitor.Install:10.0.15063.0:*PNP09FF
ROOT\BasicDisplay\0000
7/14/2017 7:51:39 PM
7/14/2017 7:51:39 PM
7/14/2017 7:51:39 PM
7/14/2017 7:51:39 PM
6/20/2006 7:00:00 PM
10.0.15063.0
Generic PnP Monitor
monitor.inf
PnPMonitor.Install
*PNP09FF
Microsoft
16719872

Not the most promising start. 不是最有希望的开始。

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

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