Powershell trying to retrieve some info on usb audio device

Vincent Woldhuis 26 Reputation points
2022-11-21T08:56:32.877+00:00

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} | 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

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. DaveK 1,871 Reputation points
    2022-11-21T09:33:42.227+00:00

    Hi, I would expect someone with a better knowledge of pipeline work might be able to clean this up a bit but the code works. I've only got one USB audio device so I can only test so far but it should get you started and it does return the parent as seen in Device Manager when checking manually.

    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  
    	}  
    }  
    

0 additional answers

Sort by: Most helpful

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.