Ho can I check whether a device is connected to a specific USB port

Sravanthi Simhadri 0 Reputation points
2024-06-05T23:52:14.32+00:00

My computer has 3 USB ports. I want a powershell command to be able to detect whether or not a usb device is connected to a specific port. I am able to use commands like gwmi to dump all usb connected devices, but I want to be able to detect based on port number. Is that possible?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,880 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Marcin Policht 40,310 Reputation points MVP
    2024-06-06T02:27:21.8266667+00:00

    Refer to https://stackoverflow.com/questions/18192159/how-to-determine-which-usb-port-is-being-used


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

  2. Rich Matheisen 47,766 Reputation points
    2024-06-06T02:38:40.8266667+00:00

    You might want to check with someone more familiar with PC hardware, but I'm pretty sure that there's a USB controller and there's a bus. The "ports" you're asking about are (I think) just the external connectors to the bus. Think of those connectors as if they were "ports" on a network hub.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.