Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting USB port name and details

Tags:

powershell

usb

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.

like image 624
Akhil Avatar asked Nov 22 '12 09:11

Akhil


People also ask

How do you reveal detailed information on a USB?

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.


1 Answers

gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} |select name,description,  deviceID, manufacturer | format-table -group by manufacturer

Some explanation

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&..'"
like image 176
Loïc MICHEL Avatar answered Nov 15 '22 08:11

Loïc MICHEL