Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
When managing Windows environments, especially in networked or enterprise settings, it's crucial to have tools that allow you to efficiently manage hardware devices. PowerShell, a task automation and configuration management framework from Microsoft, provides a powerful cmdlet called Get-PnpDevice
. This cmdlet is used to retrieve information about Plug and Play (PnP) devices on a local or remote system.
The Get-PnpDevice
cmdlet is part of the PnPDevice
module in PowerShell. It allows you to query and manage PnP devices, which are hardware components that can be automatically detected and configured by the operating system. This cmdlet can be particularly useful for system administrators who need to audit hardware configurations, troubleshoot device issues, or automate hardware management tasks.
Before using Get-PnpDevice
, ensure that the PnPDevice
module is installed on your system. You can install it via PowerShell Gallery using the following command:
Install-Module -Name PnPDevice -Scope CurrentUser
List All PnP Devices
To list all PnP devices on your system, you can use the following command:
Get-PnpDevice
This command retrieves a list of all PnP devices, including their status and device IDs.
Filter Devices by Status
If you want to list only devices that are not working properly, you can filter by the status:
Get-PnpDevice | Where-Object { $_.Status -ne 'OK' }
This command helps identify devices that are experiencing issues.
Find Devices by Class
To find devices belonging to a specific class, such as network adapters, use the -Class
parameter:
Get-PnpDevice -Class "Net"
This command lists all network adapters on the system.
Get Detailed Information for a Specific Device
You can retrieve detailed information about a specific device by using its instance ID:
Get-PnpDevice -InstanceId "PCI\VEN_8086&DEV_15B8&SUBSYS_07A71028&REV_31\3&11583659&0&FE"
Replace the instance ID with the actual ID of the device you are interested in.
Check Device Driver Status
To check the driver status of a specific device, you can combine Get-PnpDevice
with Get-PnpDeviceProperty
:
$device = Get-PnpDevice -InstanceId "PCI\VEN_8086&DEV_15B8&SUBSYS_07A71028&REV_31\3&11583659&0&FE"
Get-PnpDeviceProperty -InstanceId $device.InstanceId -KeyName "DEVPKEY_Device_DriverVersion"
This command retrieves the driver version for the specified device.
The Get-PnpDevice
cmdlet is a powerful tool for managing and troubleshooting PnP devices in Windows environments. By using this cmdlet, system administrators can automate device management tasks, quickly identify hardware issues, and ensure that all devices are functioning correctly.