8

To list the plugged in usb devices from software, preferably a shell.

Linux, or at least some Linuies seem to have a command to do that lsusb

2 Answers 2

2

You can play around with Get-PnpDevice, and its Parameters -Class, -Status and -InstanceId

See the different outputs (I used -Status OK in all examples, since I believe you need that to get the currently active ones. If you want to see everything, don't use this parameter):

InstanceId (Will only show stuff where InstanceId like 'USB*'):

PS C:\> Get-PnpDevice -InstanceId 'USB*' -Status OK

Status     Class           FriendlyName                  InstanceId
------     -----           ------------                  ----------
OK         HIDClass        USB-Input device              USB\VID_03F0&P…
OK         HIDClass        USB-Input device              USB\VID_0B0E&P…
OK         MEDIA           Logitech BRIO                 USB\VID_046D&P…
OK         USB             USB-Root-Hub (USB 3.0)        USB\ROOT_HUB30…
OK         USB             Logitech BRIO                 USB\VID_046D&P…
OK         USB             USB-Composite unit            USB\VID_0B0E&P…
OK         MEDIA           Jabra PRO 9460                USB\VID_0B0E&P…
OK         Image           Logitech BRIO                 USB\VID_046D&P…
OK         HIDClass        USB-Input device              USB\VID_1BCF&P…
OK         HIDClass        USB-Input device              USB\VID_03F0&P…
OK         USB             USB-Composite unit            USB\VID_03F0&P…

Class (See the difference to InstanceId, we have one return with InstanceId PCI*):

PS C:\> Get-PnpDevice -Class 'USB' -Status OK

Status     Class           FriendlyName                  InstanceId
------     -----           ------------                  ----------
OK         USB             USB-Root-Hub (USB 3.0)        USB\ROOT_HUB30…
OK         USB             Logitech BRIO                 USB\VID_046D&P…
OK         USB             USB-Composite unit            USB\VID_0B0E&P…
OK         USB             Intel(R) USB 3.0 eXtensi...   PCI\VEN_8086&D…
OK         USB             USB-Composite unit            USB\VID_03F0&P…

InstanceId and Class (the most strict one):

PS C:\> Get-PnpDevice -InstanceId 'USB*' -Class USB -Status OK

Status     Class           FriendlyName                  InstanceId
------     -----           ------------                  ----------
OK         USB             USB-Root-Hub (USB 3.0)        USB\ROOT_HUB30…
OK         USB             Logitech BRIO                 USB\VID_046D&P…
OK         USB             USB-Composite unit            USB\VID_0B0E&P…
OK         USB             USB-Composite unit            USB\VID_03F0&P…

Then you can create a function and put it in your PowerShell Profile, and simply use it like you would in Linux

PS C:\> Function lsusb { Get-PnpDevice -InstanceId 'USB*' -Class 'USB' -Status OK }
PS C:\> lsusb

Status     Class           FriendlyName                  InstanceId
------     -----           ------------                  ----------
OK         USB             USB-Root-Hub (USB 3.0)        USB\ROOT_HUB30…
OK         USB             Logitech BRIO                 USB\VID_046D&P…
OK         USB             USB-Composite unit            USB\VID_0B0E&P…
OK         USB             USB-Composite unit            USB\VID_03F0&P…

Play around with the Get-PnPDevice cmdlet and see what fits your needs.

0

The following worked for me in XP - https://usbdeview.en.softonic.com/. I remember using it before in my Windoze days, so after a quick scan using Kaperky, I touched wood and ran it. My only criticism is "too much information". It seems to list every single thing I've plugged into my system ever!

I'm afraid I don't know anything that will run from a DOS prompt. Hope this helps.

1
  • Well the output from the lsusb command was verbose to say the least as well, but only displayed was was currently attached. However, I believe it also listed every single port on every single usb bus.
    – leeand00
    May 11, 2019 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.