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_QuickFixEngineering WMI objects...
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 , we tried to install all the hotfixes of KB 2591403 but this didn't resolve the issue.
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 installation" 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_QuickFixEngineering | select Description, Hotfixid
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 :
AddLog( _T( "WMI GetHotFixes: Trying to find Win32_QuickFixEngineering WMI objects...\n"));
try
{
CSoftware myObject;
UINT uIndex = 0;
CString csBuffer1, csBuffer2;
if (m_dllWMI.BeginEnumClassObject( _T( "Win32_QuickFixEngineering")))
{
while (m_dllWMI.MoveNextEnumClassObject())
{
[...]
uIndex ++;
}
m_dllWMI.CloseEnumClassObject();
AddLog( _T( "\tOK (%u objects)\n"), uIndex);
return TRUE;
}
AddLog( _T( "\tFailed because no Win32_QuickFixEngineering object !\n"));
return FALSE;
}
catch (CException *pEx)
{
pEx->Delete();
AddLog( _T( "\tFailed because unknown exception !\n"));
return FALSE;
}
Conclusion : MoveNextEnumClassObject doesn't return an exception and mot probably report false, and uIndex keep it's initialization value of 0.
No timeout is found in this cpp.
Having a look at OcsWmi.cpp :
BOOL COcsWmi::MoveNextEnumClassObject()
{
ASSERT( m_pEnumClassObject);
try
{
ULONG uReturned = 1;
if (m_pClassObject)
m_pClassObject->Release();
m_pClassObject = NULL;
// Enumerate through the resultset.
m_hResult = m_pEnumClassObject->Next( 30000, // Timeout 30 s
1, // Return just one storage device
&m_pClassObject, // Pointer to storage device
&uReturned); // Number obtained: one or zero
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 MoveNextEnumClassObject.
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), MoveNextEnumClassObject return False and CWmi::GetHotFixes return 0 objects.
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::MoveNextEnumClassObject in order to check if it resolve the issue ?
Thanks in advance.
Sylvie