Hello,
This is my first post here, i need to retrieve info from device manager and the tab details and the property = “parent”
I use this ps code:
gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Where-Object {$_.Service -match 'usbaudio' } | Sort Manufacturer,Name,Parent | Ft -GroupBy Manufacturer Name,Parent
But the property “parent” is returning empty every time, while its not empty in windows.
Does someone know how to retrieve correctly the info from this property “parent” please ?
thanks
hello and welcome to forums!
You can specify whatever instead of parent and it will turn out blank:
gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Where-Object {$_.Service -match 'mouhid' } | select ASDF
Output:
ASDF
----
A solution is to select a member that exists, to get a list of available members run:
gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} | Where-Object {$_.Service -match 'mouhid' } | gm
But obviously there is no “Parent” member, so maybe it’s called something else in PS
1 Like
Hi, welcome to the forum 
It required some digging to get the parent information. As always Get-Member
is your friend for exploring the properties and methods of objects. Try this:
(Get-WmiObject Win32_USBControllerDevice |
ForEach-Object { [WMI]($_.Dependent) } |
Where-Object { $_.Service -match 'usbaudio' }).GetDeviceProperties('DEVPKEY_Device_Parent') |
Select-Object -ExpandProperty DeviceProperties |
Select-Object Data
1 Like
Thanks for the help, managed to find the answer
I had posted this question also on microsoft forums yesterday, and another user came with almost the same answer as yours, and it works, thanks for your help:
This is the solution if this could help others too :
ForEach ($Device in (gwmi Win32_USBControllerDevice | ForEach {[wmi]($_.Dependent)} |
Where-Object {$_.Service -match 'usbaudio'})){
[PSCustomObject]@{
Manufacturer = $Device.Manufacturer
Name = $Device.Name
Parent = (Get-PnpDeviceProperty -InstanceId $Device.PNPDeviceID -KeyName DEVPKEY_Device_Parent).Data
}
}