How can I get all USB ports and related details like port name, using Power Shell Script?
I tried Win32_USBControllerDevice class
. But did not get a port name.
You can use the dmesg command to find out more information about the connected USB devices. The last connected USB device is the easiest to find with dmesg command. It is more widely used for debugging purpose.
gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} |select name,description, deviceID, manufacturer | format-table -group by manufacturer
The WMI class WIN32_USBControllerDevice
describes the connection between USB controllers (The Antecedent
) and their logical devices [CIM_LOGICALDEVICE]
(the 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" Dependent : \\.\root\cimv2:Win32_PnPEntity.DeviceID="USB\\ROOT_HUB\\4& 10B856B0&0"
now you can check win32_PnPEntity
to get more info about the device ex:
gwmi Win32_PnPEntity -Filter "DeviceID='USBSTOR\\DISK&..'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With