Powershell Scan for PDQi - Device Manager Errors

So I am running a PDQi PowerShell scan as follows...

Issue I am having is the PDQi tables for the scanner don't update once the error has been resolved and a subsequent scan is performed.

If I run the script manually in a PS window on the PC, I no longer get the error as long as the device manager issues have been resolved.  I can toggle disabling a device in device manager and rerun the script in a local PS window on the PC to show data again etc. etc...

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

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."}
....

}
$ProblemDevice | ForEach-Object {
[PSCustomObject]@{
"Problem Device" = $_.Name
"Manufacturer" = $_.Manufacturer
"Device ID" = $_.DeviceID
"Error Code" = $_.ConfigManagerErrorCode
"Error Description" = $ErrorDesc
}
}
}
0

Comments

1 comment
Date Votes

Please sign in to leave a comment.

Didn't find what you were looking for?

New post