WMI GetHotFixes randomly report 0 objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OCS Inventory: Windows Agent |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hello,
We have an issue with OCS Windows agent on Windows Vista and W7 devices (several hundreds) :
"Randomly" hotfixe are not reported in the SOFTWARES table.
In file SysInfo.log with debug level 2 activated we see :
WMI GetHotFixes: Trying to find Win32_QuickFixE
OK (0 objects)
Notice that the issue is not seen on Windows 8.1 and Windows 10 devices.
We first discovered the issue with devices having agent 2.1.1.1 but have the same symptoms with agent 2.1.1.3.
As recommended is the [changelog ](https:/
If we try to force an inventory on a device having reported no hotfixe, it may once report the hotfixes... or not :-)
As OCS is linked to a GLPI instance, the glpi_logs table is growing very fast.
For the impacted devices, we indeed find around 300 "software uninstallation" logs if OCS did not report the hotfixes and again around 300 "software installation" logs if this time OCS reported the hotfixes.
We discovered that if we try and run an inventory just after a windows logon, ocs agent mainly fails to report the hotfixes.
We then thought it could be a timeout of WMI and tried to run these simple commands just after Windows logon :
date
gwmi Win32_QuickFixE
date
The "gwmi" command answer in more than on minute on devices having this issue.
So we dived in the code and saw the following :
[Wmi.cpp](https:/
AddLog( _T( "WMI GetHotFixes: Trying to find Win32_QuickFixE
try
{
CSoftware myObject;
UINT uIndex = 0;
CString csBuffer1, csBuffer2;
if (m_dllWMI.
{
while (m_dllWMI.
{
[...]
uIndex ++;
}
m_dllWMI.
AddLog( _T( "\tOK (%u objects)\n"), uIndex);
return TRUE;
}
AddLog( _T( "\tFailed because no Win32_QuickFixE
return FALSE;
}
catch (CException *pEx)
{
pEx->Delete();
AddLog( _T( "\tFailed because unknown exception !\n"));
return FALSE;
}
Conclusion : MoveNextEnumCla
No timeout is found in this cpp.
Having a look at [OcsWmi.cpp](https:/
BOOL COcsWmi:
{
ASSERT( m_pEnumClassObj
try
{
ULONG uReturned = 1;
if (m_pClassObject)
m_pClassObje
m_pClassObject = NULL;
// Enumerate through the resultset.
m_hResult = m_pEnumClassObj
1, // Return just one storage device
if (SUCCEEDED( m_hResult) && (uReturned == 1))
return TRUE;
return FALSE;
}
catch (CException *pEx)
{
pEx->Delete();
m_hResult = WBEM_E_FAILED;
return FALSE;
}
}
Here we find the 30 s timeout of MoveNextEnumCla
If timeout reached, no exception is returned rather "FALSE".
So, maybe we are not correct but it seems to us that if wmi is too long (for example if inventory is run a short time after logon), MoveNextEnumCla
We don't have any tool or knowledge to recompile the agent with a bigger timeout value.
Could someone provide us with a test agent having a 2 minutes (120000) timeout in COcsWmi:
Thanks in advance.
Sylvie
Notice, this bug is also reported on github : https:/
The project OCS Inventory NG is now on Github => https:/ /github. com/OCSInventor y-NG
Launchpad is not used anymore