Where can I find a device’s firmware version in WMI?

WMI Browse for Instance 2Many hardware vendors store the firmware version of their devices in WMI. Extracting this value can give you some very important information when it comes to determining which devices may need to have their firmware updated.

In this example I am using the Microsoft WMI Object Browser, which is no longer available (but there are other tools out there that will do the job).

Let’s say that I want to script a solution that reports the Firmware version for all the Smart Card Readers in my organization. In the following screenshots you can see where this data can be viewed via the Device Manager:

By looking at the properties of the device I can see both the Device Instance ID (this is important when you need to extract this device via WMI) and the Firmware Version.

When you open the WMI Object Browser change the namespace from root\cimv2 to root\WMI.

The property that we are interested in is FirmwareRevision.

Here is an example of extracting this property in Visual Basic .NET.

Private Function GetFirmware(ByVal id As String) As String
Dim firmWare As String = “”
Dim objFirmWare As New ManagementObjectSearcher(“\\.\root\WMI”, “SELECT * FROM MSDeviceUI_FirmwareRevision where InstanceName = ‘” & id.Replace(“\”, “\\”) & “_0′”)
For Each objMgmt As ManagementObject In objFirmWare.Get
firmWare = AsString(GetWmiValue(objMgmt, “FirmwareRevision”))
Catch ex As Exception
‘ do nothing
End Try
Return firmWare
End Function

When this function is instantiated it processes an argument called ID. This ID is extracted in a previous Class via the Microsoft tool DevCon.exe. Devcon.Exe is a decent command line utility used to extract information available via Device Manager. While this article is not centered on Devcon.exe, I will include an example of the output of devcon.


As you can see from the example, the first line returned is the DeviceID that I need in my WMI Query.

As always, if you have questions, comments or smart-ass remarks, let me know.