PS C:\> Get-WmiObject Win32_PNPEntity | Where-Object{$_.ConfigManagerErrorCode -ne 0} | Select Name, DeviceID

Name       DeviceID
----       --------
           ACPI\INT33A0\0
PCI Device PCI\VEN_8086&DEV_1E20&SUBSYS_A0141458&REV_04\3&11583659&0&D8

Скрипт для Icinga2 с расшифровкой кода ошибки устройства:

<#
 .SYNOPSIS
  Скрипт для Icinga 2 - Поиск устройств с проблемами

 .DESCRIPTION


 .PARAMETER ComputerName
  Имя компьютера

 .OUTPUTS


 .EXAMPLE
.\check_problem_devices.ps1 -ComputerName localhost

Devices WARNING 2 units
 (ACPI\INT33A0\0): Device drivers are not installed. (28)
PCI Device (PCI\VEN_8086&DEV_1E20&SUBSYS_A0141458&REV_04\3&11583659&0&D8): Device drivers are not installed. (28)


 .LINK
  https://webnote.satin-pl.com/2019/02/28/posh_find_unknown_device/

 .NOTES
  Version:        0.1
  Author:         Pavel Satin
  Email:          plsatin@yandex.ru
  Creation Date:  04.03.2019

#>
Param(
    [Parameter(Mandatory = $false)]
    [string]$ComputerName = "localhost"
)


# $ErrorActionPreference = "SilentlyContinue"
# [Console]::OutputEncoding = [System.Text.Encoding]::UTF8

# $ProgDataFolder = [Environment]::GetFolderPath("CommonApplicationData")
# $icinga2ScriptsPath = "$ProgDataFolder\icinga2\Scripts\icinga2"
# Import-Module "$icinga2ScriptsPath\icinga2scripts.psm1" #-Verbose


$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2
$returnStateUnknown = 3
$returnState = $returnStateUnknown

$output = ""
$countDevice = 0




$ProblemDevices = Get-WmiObject Win32_PNPEntity -ComputerName $ComputerName | 
    Where-Object{$_.ConfigManagerErrorCode -ne 0} | 
    Select-Object Name, DeviceID, ConfigManagerErrorCode

ForEach($ProblemDevice in $ProblemDevices){
    $ErrorDesc = Switch ($ProblemDevice.ConfigManagerErrorCode){
        1 {"Device is not configured correctly."}
        2 {"Windows cannot load the driver for this device."}
        3 {"Driver for this device might be corrupted, or the system may be low on memory or other resources."}
        4 {"Device is not working properly. One of its drivers or the registry might be corrupted."}
        5 {"Driver for the device requires a resource that Windows cannot manage."}
        6 {"Boot configuration for the device conflicts with other devices."}
        7 {"Cannot filter."}
        8 {"Driver loader for the device is missing."}
        9 {"Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device."}
        10 {"Device cannot start."}
        11 {"Device failed."}
        12 {"Device cannot find enough free resources to use."}
        13 {"Windows cannot verify the device's resources."}
        14 {"Device cannot work properly until the computer is restarted."}
        15 {"Device is not working properly due to a possible re-enumeration problem."}
        16 {"Windows cannot identify all of the resources that the device uses."}
        17 {"Device is requesting an unknown resource type."}
        18 {"Device drivers must be reinstalled."}
        19 {"Failure using the VxD loader."}
        20 {"Registry might be corrupted."}
        21 {"System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device."}
        22 {"Device is disabled."}
        23 {"System failure. If changing the device driver is ineffective, see the hardware documentation."}
        24 {"Device is not present, not working properly, or does not have all of its drivers installed."}
        25 {"Windows is still setting up the device."}
        26 {"Windows is still setting up the device."}
        27 {"Device does not have valid log configuration."}
        28 {"Device drivers are not installed."}
        29 {"Device is disabled. The device firmware did not provide the required resources."}
        30 {"Device is using an IRQ resource that another device is using."}
        31 {"Device is not working properly.  Windows cannot load the required device drivers."}
    }
    $output +=  "$($ProblemDevice.Name) ($($ProblemDevice.DeviceID)): "
    $output +=  "$ErrorDesc ($($ProblemDevice.ConfigManagerErrorCode))`n"
    $countDevice = $countDevice + 1
}


if ($output -eq "" ) {
    Write-Host "Devices OK"

    Write-Host $output
    [System.Environment]::Exit($returnStateOK)

} else {
    Write-Host "Devices WARNING $countDevice units"

    Write-Host $output
    [System.Environment]::Exit($returnStateWarning)

}

Ссылки