Hosts: Inventory: Operating System: version details missing

2.1.0p5 raw; Ubuntu 20.04 LTS; Windows 10 22H2 end points

I have mk_inventory.vbs for Check_MK HW/SW Inventory running on Windows end points for more than a year.

I made a custom view of Windows hosts, with the intention to keep track of recent updates are installed or not.

Hosts: Inventory: Operating System ➤ Kernel Version gives 10.0.19045, which is nice, but doesn’t change so often. The essential info, namely the Windows Update Build Revision (UBR), I have it on PDQ Inventory but I want to retire that tool, is not to be found on Checkmk.
Maybe it is Hosts: Inventory: Operating System ➤ Version, but it returns empty.
Also Hosts: Inventory: Operating System ➤ Service Packs is empty.
Not sure if this is a bug or misconfiguration.

Less important, but also nice to have would be to display the feature update version, which currently is 22H2 for most of my clients here.

Looked in mk_inventory.vbs and saw it uses WMI to get the Win32_OperatingSystem details. What I am after, I can’t find it in WMI.

Did find most of the information in the Windows registry:

; OS version 10.0.19045.3324 seperated over 4 keys
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\]
"CurrentMajorVersionNumber"=dword:0000000a
"CurrentMinorVersionNumber"=dword:00000000
"CurrentBuildNumber"="19045"
"UBR"=dword:00000cfc

; OS version 10.0.19045.3324 as 1 string
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Update\TargetingInfo\Installed\Client.OS.rs2.amd64]
"Version"="10.0.19045.3324"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Update\TargetingInfo\Installed\Windows.UpdateStackPackage.amd64]
"Version"="10.0.19045.3324"

; Feature update version
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\]
"DisplayVersion"="22H2"

I didn’t find a Werk related to above.

Where to go from here?

  • maybe it’s a bug or not available for raw
  • feature request and just wait…
  • modify mk_inventory.vbs, so Hosts: Inventory: Operating System ➤ Kernel Version shows UBR too.
    anyone who did this already and give pointers or code?
  • recommendations for a different approach, which also gives value as option for column in custom host view.

I went for modifying mk_inventory.vbs.

Changes I made:

  • Added a V for Victory … ehm no … Version at the constant.
    Since I am running 2.1.0p5 mine says:
    Const CMK_VERSION = "2.1.0p5 V"
  • replaced Sub getWMIObject2(strClass,arrVars) with below code where I’m catching variable version and replacing it with values from the registry.
Sub getWMIObject2(strClass,arrVars)
    Set Entries = objClass.ExecQuery("Select * from " & strClass)
    For Each entry in Entries
        strTemp = "A"
        For Each label in arrVars
            strTemp = strTemp & "|"
			If LCase(label) = "version" Then
				' Get version with ubr out of registry combining 4 keys
				Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\default:StdRegProv")
				strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
				oReg.GetDWORDValue HKLM,strKeyPath,"CurrentMajorVersionNumber",regValue
				strVersion = regValue
				oReg.GetDWORDValue HKLM,strKeyPath,"CurrentMinorVersionNumber",regValue
				strVersion = strVersion & "." & regValue
				oReg.GetStringValue HKLM,strKeyPath,"CurrentBuildNumber",regValue
				strVersion = strVersion & "." & regValue
				oReg.GetDWORDValue HKLM,strKeyPath,"UBR",regValue
				strVersion = strVersion & "." & regValue
				strTemp = strTemp & strVersion
			Else
				For Each item in entry.Properties_
                If LCase(item.name) = LCase(label) Then
                    strTemp = strTemp & item.value
                End If
            Next
			End If
        Next
        outPut(Mid(strTemp,3))
    Next
End Sub

Changed custom view to have HW/SW tree visible for this screenshot, but this is the result of above changes:

Be aware that you might not see the kernel version change directly since mk_inventory.vbs has a default delay of 4 hours and 5 minutes.

I added a feature request for an official change:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.