Share via

Using Powershell to parse Device Manger, View by Connection

johnch99 1 Reputation point
2024-11-08T19:42:56.5766667+00:00

In Device Manager, and you can change the "View" and select Device by connection. With this view you can see how devices are connected or chained together in cascade view. In Powershell when I run Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' I get this output:

Status Class FriendlyName


OK USB USB4(TM) Host Router (Microsoft)

OK USB USB4(TM) Host Router (Microsoft)

OK USB USB4 Root Router (1.0)

OK USB USB4 Root Router (1.0)

But in Device Manager, View by Device by connection I like to arrange like this:

Status Class FriendlyName


OK USB USB4(TM) Host Router (Microsoft)

OK USB USB4 Root Router (1.0)

OK USB USB4(TM) Host Router (Microsoft)

OK USB USB4 Root Router (1.0)

How can this be done Powershell and save in a text file?

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2024-11-11T08:05:52.0566667+00:00

    Hi johnch99,

    You can sort the result by the FriendlyName property.

    Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' | Sort-Object -Property FriendlyName 
    

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Was this answer helpful?

    0 comments No comments

  2. Nicolai Samuelsen 0 Reputation points
    2024-11-08T20:02:22.1666667+00:00

    (Sorry if this is being posted twice. I seem to have a bug)

    You can pipe your result to an export. Examples

    Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' | Export-CSV -Path <somepath>
    Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' | Out-File -FilePath <somepath>

    Was this answer helpful?

    0 comments No comments

  3. Nicolai Samuelsen 0 Reputation points
    2024-11-08T19:59:28.4233333+00:00

    Hello johnch99, you can pipe the results to the export option you want to use.

    Examples:
    Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' | Export-CSV -Path <some path>
    Get-PnpDevice -FriendlyName 'USB4*' -class 'USB' | Out-File -FilePath <some path>

    Was this answer helpful?

    0 comments No comments

Your answer

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