problem with the wmi_info() function
Published: April 17, 2026 - 3:25 PM
Good morning,
I installed the tis-audi-wmi package, and it works well and correctly reports wmi information in the audit data.
In wapt packages, I used to use the wmi_info() function, but now when I test it in pyscripter, it consistently fails with the same errors:
This occurs on different machines, therefore regardless of the Windows version
However, I am using the correct syntax and expected values for the keys parameter, similar to those of the package's audit function:
I verified that wmi was correct (winmgmt /verifyrepository OK) and the audi-wmi package correctly retrieves wmi information.
Do you see what the problem is? I would like to be able to use the very practical wmi_info() function in packages, which collects a lot of data.
I installed the tis-audi-wmi package, and it works well and correctly reports wmi information in the audit data.
In wapt packages, I used to use the wmi_info() function, but now when I test it in pyscripter, it consistently fails with the same errors:
Code: Select all
*** Python 3.10.19 (main, Jan 29 2026, 18:58:30) [MSC v.1929 32 bit (Intel)] on win32. ***
*** Distant Python engine is active ***
>>> from setuphelpers import *
>>> wmi_info_test1=wmi_info(keys=['Win32_ComputerSystem','Win32_ComputerSystemProduct','Win32_BIOS'])
WMI error Invalid value for list argument, fallback to py wmi
>>> wmi_info_test1=wmi_info(keys=['Win32_ComputerSystem','Win32_ComputerSystemProduct','Win32_BIOS'])
WMI error Invalid value for list argument, fallback to py wmi
WMI is broken on this computer. See https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-rebuilding-the-wmi-repository/ba-p/373846 : x_wmi_uninitialised_thread: <x_wmi: WMI returned a syntax error: you're probably running inside a thread without first calling pythoncom.CoInitialize[Ex] (no underlying exception)>
>>> wmi_info_test2=wmi_info(keys=['Win32_NetworkAdapter','Win32_PhysicalMemory','Win32_Printer','Win32_VideoController'])
WMI error Invalid value for list argument, fallback to py wmi
WMI is broken on this computer. See https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-rebuilding-the-wmi-repository/ba-p/373846 : x_wmi_uninitialised_thread: <x_wmi: WMI returned a syntax error: you're probably running inside a thread without first calling pythoncom.CoInitialize[Ex] (no underlying exception)>
>>>
However, I am using the correct syntax and expected values for the keys parameter, similar to those of the package's audit function:
Code: Select all
def audit():
wmi_keys = ['Win32_ComputerSystem','Win32_ComputerSystemProduct','Win32_BIOS',
'Win32_NetworkAdapter','Win32_PhysicalMemory','Win32_Printer','Win32_VideoController',
'Win32_LogicalDisk','Win32_OperatingSystem','Win32_DesktopMonitor',
'Win32_USBController','Win32_SystemEnclosure','Win32_DiskDrive',
'Win32_Volume','Win32_PnPSignedDriver']
data_wmi_info = wmi_info(keys = wmi_keys)
WAPT.write_audit_data_if_changed("audit-wmi", "audit-wmi", data_wmi_info)
return "OK
Do you see what the problem is? I would like to be able to use the very practical wmi_info() function in packages, which collects a lot of data.