ConfigManagerErrorCode. A pratical use for Missing / Bad Drivers after Windows 10 OSD

 

While working through a TechNet / Docs page recently I spotted a new (no idea how long it has been there) property in a ton of classes.

ConfigManagerErrorCode

At first I thought it was related to Microsoft System Center Configuration Manager (SCCM) 2012 Current Branch (CB).  Nope, apparently it is an attribute added to tons of WMI CIM and Win32 classes.  Very useful to figure out why things are not functioning correctly with details.   An oversimplified version is show in the Windows GUI…

clql3m4ucaehwbs

..but ConfigManagerErrorCode provides details.  Okay great, I found a property I didn’t know about.  How does this help anyone?

Doing Windows 10 Operating System Deployment (OSD) at scale and for Windows Insiders I frequently find post migration driver issues.  Too much time is spent guessing on what those errors are.  The example below is about finding devices that do not have drivers in functioning status.

Example of using ConfigManagerErrorCode to find Machines with Device Driver issues

The PNP Entity class is populated with the same information you find in Device Manager (devmgmt.msc) – https://technet.microsoft.com/en-us/library/cc754081(v=ws.11).aspx (See the picture above).  Which is great if you are logged in and have free time.

Win32_PNPEntity class allows you to query a machine remotely either via PowerShell (below) or via SCCM CB Hardware Inventory Classes (HINV) further down.  Good news SCCM gathers this class and property by default.

Win32_PNPEntity https://msdn.microsoft.com/en-us/library/aa394353(v=vs.85).aspx

Where any driver does not equal 0 for ConfigManagerErrorCode means we have driver issues.  Look at the Link above, search for ConfigManagerErrorCode, to translate all non-zero values.  I found a ton with status 28.  And then went out to the OEM for the drivers.

PowerShell for PNP devices with issues

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

windows-live-writer-back-to-basics-finding-drivers-and-cer_9669-dev004_thumb

PowerShell for PNP Devices that are not available

Great but what about machines where the device is not available?

Get-WmiObject Win32_PNPEntity | Where-Object{$_.Availability -eq 11 -or $_.Availability -eq 12 -or $_.Availability -eq 19 -or $_.Availability -eq 20}

Great now let’s make this readable output

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

#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 -or $_.Availability -eq 11 -or $_.Availability -eq 12 -or $_.Availability -eq 19 -or $_.Availability -eq 20 } | Format-Table $result -AutoSize

SCCM CB Collection

Cool. This means I can quickly get a report on nonfunctional or available PNP devices in seconds.   Creating a collection in SCCM CB is just as easy.  Here is the same query in WQL.  This is used for a Collection membership query.

Select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_System.Name,
SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainOrWorkgroup,
SMS_R_System.Client

From SMS_R_System inner join SMS_G_System_PNP_DEVICE_DRIVER on 
SMS_G_System_PNP_DEVICE_DRIVER.ResourceID = SMS_R_System.ResourceID

Where SMS_G_System_PNP_DEVICE_DRIVER.ConfigManagerErrorCode != 0 or 
 SMS_G_System_PNP_DEVICE_DRIVER.Availability in (11,12,19,20)

Parting Thought

I wrote a post about SMART hard drive queries a while ago.  The Win32_DiskDrive class also has the ConfigManagerErrorCode property with useful details

Reference Information

Device Manager Error Codes

https://support.microsoft.com/en-us/kb/310123

SCCM Just for Reference (not what we are talking about today)

About Configuration Manager Errors (SCCM Errors) https://msdn.microsoft.com/library/hh442812.aspx

Classes with ConfigManagerErrorCode

Class Link
CIM_AggregatePExtent
CIM_AggregatePSExtent
CIM_AlarmDevice
CIM_Battery
CIM_BinarySensor
CIM_CacheMemory
CIM_CDROMDrive
CIM_Controller
CIM_CoolingDevice
CIM_CurrentSensor
CIM_DesktopMonitor
CIM_DiscreteSensor
CIM_DiskDrive
CIM_DisketteDrive
CIM_DiskPartition
CIM_Display
CIM_Fan
CIM_FlatPanel
CIM_HeatPipe
CIM_InfraredController
CIM_Keyboard
CIM_LogicalDisk
CIM_MagnetoOpticalDrive
CIM_ManagementController
CIM_MediaAccessDevice
CIM_Memory
CIM_MultiStateSensor
CIM_NetworkAdapter
CIM_NonVolatileStorage
CIM_NumericSensor
CIM_ParallelController
CIM_PCIController
CIM_PCMCIAController
CIM_PCVideoController
CIM_PhysicalExtent
CIM_PointingDevice
CIM_PotsModem
CIM_PowerSupply
CIM_Printer
CIM_Processor
CIM_ProtectedSpaceExtent
CIM_Refrigeration
CIM_Scanner
CIM_SCSIController
CIM_Sensor
CIM_SerialController
CIM_StorageExtent
CIM_StorageVolume
CIM_Tachometer
CIM_TapeDrive
CIM_TemperatureSensor
CIM_UninterruptiblePowerSupply
CIM_USBController
CIM_USBDevice
CIM_USBHub
CIM_UserDevice
CIM_VideoController
CIM_VolatileStorage
CIM_VoltageSensor
CIM_VolumeSet
CIM_WORMDrive
Win32_1394Controller
Win32_Battery
Win32_Bus
Win32_CacheMemory
Win32_CDROMDrive
Win32_CurrentProbe
Win32_DesktopMonitor
Win32_DiskDrive
Win32_DiskPartition https://msdn.microsoft.com/en-us/library/aa394135(v=vs.85).aspx
Win32_Fan
Win32_FloppyController
Win32_FloppyDrive
Win32_HeatPipe
Win32_IDEController
Win32_InfraredDevice
Win32_Keyboard
Win32_LogicalDisk
Win32_MappedLogicalDisk
Win32_MemoryArray
Win32_MemoryDevice
Win32_MotherboardDevice
Win32_NetworkAdapter https://msdn.microsoft.com/en-us/library/aa394216(v=vs.85).aspx
Win32_ParallelPort
Win32_PCMCIAController
Win32_PnPEntity https://msdn.microsoft.com/en-us/library/aa394353(v=vs.85).aspx
Win32_PointingDevice
Win32_PortableBattery
Win32_POTSModem
Win32_Printer
Win32_Processor
Win32_Refrigeration
Win32_SCSIController
Win32_SerialPort
Win32_SMBIOSMemory
Win32_SoundDevice
Win32_TapeDrive
Win32_TemperatureProbe
Win32_USBController
Win32_USBHub
Win32_VideoController
Win32_VoltageProbe
Win32_Volume https://msdn.microsoft.com/en-us/library/aa394515(v=vs.85).aspx

 

 

 

Advertisements

Author: shauncassells

Shaun Cassells, Senior Solutions Engineer, 1E Shaun is a Microsoft MVP Windows Insider MVP and executive at Central Texas Systems Management User Group (CTSMUG). Shaun is a frequent speaker at conferences like MMS, Gartner, TechEd Europe, TechEd North America, IT Dev Connections, System Center Rallies, and Systems Management User Groups (SMUGs). Shaun is an award winning blogger syndicated from www.shauncassells.com. Shaun specializes in analysis, optimization, and design of Tactical Solutions to Strategic Business Goals. Prior to joining 1E in 2010, he worked for a Global 100 company as the Configuration Manager Service Owner and Architect. Recently as a Principle Consultant at 1E, he accomplished design, review, and improvements to a variety of Configuration Manager environments from the very small to sites with a half million seats. He provided leadership that created a patented automated application rationalization and usage based OSD mapping solution in use by multiple fortune 500 companies. These days you can find Shaun traveling to help discover, review, and improve business productivity across the world.

4 thoughts on “ConfigManagerErrorCode. A pratical use for Missing / Bad Drivers after Windows 10 OSD”

  1. Follow on. i have noticed a lot of newly built devices are showing no error but unidentified. Unknown device has a null name.

    Get-WmiObject -Class Win32_PnpEntity -ComputerName localhost -Namespace Root\CIMV2 | Where-Object {$_.name -like $null} | FT Name, ConfigManagerErrorCode, Availability, PNPDeviceID

    Interesting. Now I need help figuring out how to match PNPDeviceID to get the drivers. Anyone know how?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s