简体   繁体   English

如何使用powershell显示带有驱动器号的附加USB设备

[英]How to display attached USB devices with drive letter using powershell

I am attempting to list all connected usb devices using powershell.我正在尝试使用 powershell 列出所有连接的 USB 设备。 While I am able to display the devices using the following command, I cannot get the drive letter to show up, Is there a way to make that happen?虽然我可以使用以下命令显示设备,但我无法显示驱动器号,有没有办法做到这一点?

GET-WMIOBJECT win32_diskdrive | Where { $_.InterfaceType –eq ‘USB’ }

The output is as follows:输出如下:

Partitions : 1
DeviceID   : \\.\PHYSICALDRIVE1
Model      : Corsair Voyager VEGA USB Device
Size       : 61944583680
Caption    : Corsair Voyager VEGA USB Device

I think this will do it:我认为这会做到:

gwmi cim_logicaldisk | ? drivetype -eq 2

According to docs DriveType 2 is removable disk.根据文档DriveType 2 是可移动磁盘。

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

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