如何使用Power Shell Script获取所有USB端口和相关详细信息,如端口名称?
我试过Win32_USBControllerDevice class
.但没有获得端口名称。
gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} |select name,description, deviceID, manufacturer | format-table -group by manufacturer
一些解释
WMI 类WIN32_USBControllerDevice
描述了 USB 控制器(Antecedent
)与其逻辑设备[CIM_LOGICALDEVICE]
(Dependent
)之间的连接
PS>gwmi Win32_USBControllerDevice |fl Antecedent,Dependent Antecedent : \\.\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086 &DEV_3A35&SUBSYS_02931028&REV_00\\3&172E68DD&0&E9" Depend: \\.\root\cimv2:Win32_PnPEntity.DeviceID="USB\\ROOT_HUB\\4& 10B856B0&0"
现在,您可以查看win32_PnPEntity
以获取有关设备的更多信息,例如:
gwmi Win32_PnPEntity -filter "deviceID='USBSTOR\\DISK&..'"