3

This is on a Windows XP pro System (yeah I know old OS) I have been searching for a way to get a list of all devices that do not have drivers installed, or there are problems with the drivers in use.

I have tried

  $foo = Get-WmiObject Win32_PNPEntity | Where-Object{$_.ConfigManagerErrorcode -ne 0}

The problem with this, is it does not seem to get all exceptions.
For instance, a HP laptop that has a finger print scanner shows in device manager as other device - USB Device. This was not detected using the one liner I listed.

is there a way to get an array of the missing drivers using powershell?

Radagast
  • 1,026
  • 6
  • 15
  • 21
  • I don't have experience with this class. However, looking at the [documentation](http://msdn.microsoft.com/en-us/library/windows/desktop/aa394353(v=vs.85).aspx), I see some other Properties you could test that look promising. For example. 'Availability' has a value that means "not installed". There's also a Property called 'Status' that includes some error codes. Perhaps if you OR'd tests of these with your current Where-Object test you could get some additional information. – David Jul 06 '12 at 23:07

3 Answers3

3
#For formatting:
    $result = @{Expression = {$_.Name}; Label = "Device Name"},
              @{Expression = {$_.ConfigManagerErrorCode} ; Label = "Status Code" }

#Checks for devices whose ConfigManagerErrorCode value is greater than 0, i.e has a problem device.
Get-WmiObject -Class Win32_PnpEntity -ComputerName localhost -Namespace Root\CIMV2 | Where-Object {$_.ConfigManagerErrorCode -gt 0 } | Format-Table $result -AutoSize

Error Codes in Windows Device Manager :- https://support.microsoft.com/en-us/kb/310123 Win32_PNP Entity Class : https://msdn.microsoft.com/en-us/library/aa394353(v=vs.85).aspx

ArNumb
  • 307
  • 1
  • 4
  • 10
2

I did this when i had some devices that where not being picked up by my script , give it a try and see if it detects your devices.

$foo = Get-WmiObject Win32_PNPEntity | Where-Object{$_.Availability -eq 11 -or $_.Availability -eq 12}
justinf
  • 1,246
  • 2
  • 19
  • 39
0

See my more complete example here.

Get-WmiObject Win32_PNPEntity | Where-Object{[string]::IsNullOrEmpty($_.ClassGuid) } | Select-Object Name,Present,Status,DeviceID | Sort-Object Name
not2qubit
  • 14,531
  • 8
  • 95
  • 135