What PowerShell command shows which PCIe lanes a device uses?
Asked by
MellowCedar42
I'm trying to remember a PowerShell or Command Prompt command that showed how devices are connected to a PC—such as whether they connect through the CPU or chipset—and how many PCIe lanes each device is using. I initially thought it might be related to listing Plug and Play devices, but I'm looking for the command that displays the bus or lane path information.
Answers
You can list PCI-related devices with a CIM query like this: `(Get-CimInstance Win32_PnPEntity | Where-Object {$_.DeviceID -like "*PCI*"}) | Select-Object Name,@{Name="Path/Bus";Expression={($_.DeviceID -split '\')[1]}},Status | Format-Table -AutoSize`. This shows the device name, part of its PCI path, and status, although it may not directly report the negotiated lane width.
Reply to this answer
The command you remembered may have been a script called `cpudirect.ps1`, run with `irm ... | iex`. It displays information about whether devices are connected through the CPU or chipset and their lane allocation. Be careful with commands that download and immediately execute a remote script—review the script locally first, then run it if you trust its contents.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCedar42: That was the one I was trying to find. I had been searching with the wrong terms, so thanks! I’ll inspect the script before running it.