Please help<\/p>\n
i’m using powershell on windows 7 and would like to know the correct powershell syntax for “get-wmiobect” that returns the correct Device instance path for a USB Device that is connected to an External USB Hub.<\/p>\n
Here’s the powershell command i currently use:<\/p>\n
powershell -command “& {get-wmiobject -class Win32_USBControllerDevice -computername “LocalHost” -namespace “root\\CIMV2” }”<\/p>\n
A ton of data is returned, the correct PATH for my device “200006583”, is actually:<\/p>\n
Dependent : \\xxxxxxxx\\root\\cimv2:Win32_PnPEntity.DeviceID=“USB\\VID_0856&PID_DB01\\6&266BBD26&0&2”<\/p>\n
However, get-wmiobject returns this:<\/p>\n
__PATH : \\xxxxxxxx\\root\\CIMV2:Win32_USBControllerDevice.Antecedent=“\\\\xxxxxxxx\\root\\cimv2:Win32_USBController.DeviceID=\"PCI\\\\VEN_8086&DEV_8D2D&SUBSYS_06171028&REV_05\\\\3&11583659&0&D0\"”,Dependent=“\\\\xxxxxxxx\\root\\cimv2:Win32_PnPEntity.DeviceID=\"USB\\\\VID_1111&PID_0003\\\\200006583\"”<\/p>\n
I verified the correct path by physically looking at the hardware connected and using USBView, which shows all USB connections in a graphical tree view.<\/p>\n
Thanks<\/p>","upvoteCount":3,"answerCount":3,"datePublished":"2020-07-22T07:44:30.000Z","author":{"@type":"Person","name":"brklyunix","url":"https://community.spiceworks.com/u/brklyunix"},"suggestedAnswer":[{"@type":"Answer","text":"
Please help<\/p>\n
i’m using powershell on windows 7 and would like to know the correct powershell syntax for “get-wmiobect” that returns the correct Device instance path for a USB Device that is connected to an External USB Hub.<\/p>\n
Here’s the powershell command i currently use:<\/p>\n
powershell -command “& {get-wmiobject -class Win32_USBControllerDevice -computername “LocalHost” -namespace “root\\CIMV2” }”<\/p>\n
A ton of data is returned, the correct PATH for my device “200006583”, is actually:<\/p>\n
Dependent : \\xxxxxxxx\\root\\cimv2:Win32_PnPEntity.DeviceID=“USB\\VID_0856&PID_DB01\\6&266BBD26&0&2”<\/p>\n
However, get-wmiobject returns this:<\/p>\n
__PATH : \\xxxxxxxx\\root\\CIMV2:Win32_USBControllerDevice.Antecedent=“\\\\xxxxxxxx\\root\\cimv2:Win32_USBController.DeviceID=\"PCI\\\\VEN_8086&DEV_8D2D&SUBSYS_06171028&REV_05\\\\3&11583659&0&D0\"”,Dependent=“\\\\xxxxxxxx\\root\\cimv2:Win32_PnPEntity.DeviceID=\"USB\\\\VID_1111&PID_0003\\\\200006583\"”<\/p>\n
I verified the correct path by physically looking at the hardware connected and using USBView, which shows all USB connections in a graphical tree view.<\/p>\n
Thanks<\/p>","upvoteCount":3,"datePublished":"2020-07-22T07:44:30.000Z","url":"https://community.spiceworks.com/t/usb-device-connection-path-powershell-get-wmiobject/770041/1","author":{"@type":"Person","name":"brklyunix","url":"https://community.spiceworks.com/u/brklyunix"}},{"@type":"Answer","text":"
Try querying the Win32_PnPEntity class directly? This should list out all plug and play devices on your system, and one of the properties on the returned objects is DeviceID which is what I believe you’re looking for<\/p>\n
Get-WmiObject -Class Win32_PnPEntity\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2020-07-22T08:53:17.000Z","url":"https://community.spiceworks.com/t/usb-device-connection-path-powershell-get-wmiobject/770041/2","author":{"@type":"Person","name":"francishagyard2","url":"https://community.spiceworks.com/u/francishagyard2"}},{"@type":"Answer","text":"Thanks you very much francishagyard2. I’m looking for the very same hardware path that USBView displays Graphicly. My device “200006583” is connected to External External Hub: USB#VID_0856&PID_DB01#6&266bbd26&0&2#{f18a0e88-c30c-11d0-8815-00a0c906bed8} via Port 6 and “200006570” is connected to the same USB Hub via Port 7.<\/p>\n
After reading more on powershell commands, i was able to put together the command below, that gets me a little closer to what i need but it does not report the External USB Hub ports that my devices reside on:<\/p>\n
COMMAND:<\/p>\n
powershell -command “& {Get-CimInstance -ClassName Win32_USBControllerDevice | Select-Object -Property Dependent}”<\/p>\n
OUTPUT:<\/p>\n
<\/a>Dependent<\/h2>\nWin32_PnPEntity (DeviceID = “USB\\VID_0856&PID_DB01\\6&266BBD26&0&2”)
\nWin32_PnPEntity (DeviceID = “USB\\VID_1111&PID_0003\\200006583”)
\nWin32_PnPEntity (DeviceID = “USB\\VID_1111&PID_0003\\200006570”)<\/p>","upvoteCount":0,"datePublished":"2020-07-22T16:00:17.000Z","url":"https://community.spiceworks.com/t/usb-device-connection-path-powershell-get-wmiobject/770041/3","author":{"@type":"Person","name":"brklyunix","url":"https://community.spiceworks.com/u/brklyunix"}}]}}