- 1 year ago
How to find active device id with PowerShell?
To find active device IDs using PowerShell, you can utilize the Get-PnpDevice
cmdlet along with filters to identify active devices. Here's how you can do it:
Open PowerShell: Open PowerShell with administrative privileges. You can do this by searching for "PowerShell" in the Start menu, right-clicking on "Windows PowerShell," and choosing "Run as administrator."
List All Devices: To list all devices, you can use the
Get-PnpDevice
cmdlet without any filters:powershellGet-PnpDevice
This will provide you with a list of all devices, including their device IDs.
Filter Active Devices:
If you want to list only the active devices, you can use the-Status
parameter with the valueOK
:powershellGet-PnpDevice -Status OK
This will display a list of devices with an active status.
Filter by Device Class:
You can also narrow down the list by specifying a device class. For example, if you're interested in network adapters, you can use the following:powershellGet-PnpDevice -Class Network -Status OK
Replace
Network
with the appropriate device class you want to filter by.Retrieve Device IDs:
To extract just the device IDs from the list, you can use theSelect-Object
cmdlet:powershellGet-PnpDevice -Status OK | Select-Object DeviceID
This will provide you with a list of device IDs of active devices.
Remember that device IDs are unique identifiers for devices and might look something like this: PCI\VEN_8086&DEV_15E3&SUBSYS_00008086&REV_00\3&11583659&0&C8
.
Please note that PowerShell's output might vary depending on your system and device configuration. Always make sure to review the output and understand the devices listed before taking any actions based on the results.