Please help

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.

Here’s the powershell command i currently use:

powershell -command “& {get-wmiobject -class Win32_USBControllerDevice -computername “LocalHost” -namespace “root\CIMV2” }”

A ton of data is returned, the correct PATH for my device “200006583”, is actually:

Dependent : \xxxxxxxx\root\cimv2:Win32_PnPEntity.DeviceID=“USB\VID_0856&PID_DB01\6&266BBD26&0&2”

However, get-wmiobject returns this:

__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"”

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.

Thanks

3 Spice ups

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

Get-WmiObject -Class Win32_PnPEntity
1 Spice up

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.

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:

COMMAND:

powershell -command “& {Get-CimInstance -ClassName Win32_USBControllerDevice | Select-Object -Property Dependent}”

OUTPUT:

Dependent

Win32_PnPEntity (DeviceID = “USB\VID_0856&PID_DB01\6&266BBD26&0&2”)
Win32_PnPEntity (DeviceID = “USB\VID_1111&PID_0003\200006583”)
Win32_PnPEntity (DeviceID = “USB\VID_1111&PID_0003\200006570”)