CMK version:
2.2.0p40 CEE
OS version:
Agent running on Windows Server 2016, 2019 and Windows 11.
Error message:
Msi API Error: ProductsEx,Product,UserSid,Contexts
Description of Problem
I’m using the agent bakery to install the inventory plug-in on our monitored Windows system, however the list of software installed only ever included the Checkmk Agent, and nothing else.
Looking at the agent output shows something like this:
<<<win_wmi_software:sep(0):persist(1743603394)>>>
mk_inventory.vbs(221, 21) Msi API Error: ProductsEx,Product,UserSid,Contexts
The VisualBasic version of ProductsEx doesn’t seem to like the “everyone” SID that is documented in the native C++ method.
This code (based on code in mk_inventory.vbs) demonstrates the problem.
const WI_SID_EVERYONE = "s-1-1-0"
const WI_ALL_CONTEXTS = 7
Dim oInstaller : Set oInstaller = CreateObject("WindowsInstaller.Installer")
' This gives an error: "Msi API Error: ProductsEx,Product,UserSid,Contexts"
' Dim oProducts : Set oProducts = oInstaller.ProductsEx("", WI_SID_EVERYONE, WI_ALL_CONTEXTS)
' This works
Dim oProducts : Set oProducts = oInstaller.ProductsEx("", "", WI_ALL_CONTEXTS)
For Each oProduct In oProducts
WScript.Echo(oProduct.InstallProperty("ProductName"))
Next
Unfortunately, patching the installed version of mk_inventory.vbs doesn’t seem to fix the issue, so I’m a bit lost.
Anyone got any more ideas on how to fix this?