No data returned from WMI query to Win32_PerfRawData even with data in the Performance Monitor counter
Issue
When using WMI to query a Win32_PerfRawData performance counter no data is returned. For example the following query against the CIMV2 provider does not return data:
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_CitrixICA_ICASession", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
But the following WMI query against the native Citrix provider does return data:
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\Citrix")
Set colItems = objWMIService.ExecQuery("SELECT * FROM MetaFrame_Session", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
Also the counter data can be seen in 
Administrative Tools | 
Performance
 - Add a counter
 - Select the 
ICA Session performance object
 - Select the 
All instances radio button
 - Click 
Add
 
Resolution
The following may help to resolve the issue:
 - Start the 
WMI Performance Adapter service 
 - Start the 
Citrix WMI service 
 - Run the command 
winmgmt /clearadap
 - Run the command 
winmgmt /resyncperf
 - Restart the 
Windows Management Instrumentation service
Otherwise re-register and recompile WMI providers.
Microsoft:
c:
cd %windir%\system32\wbem\
for %i in (*.dll) do RegSvr32 /s %i
for %i in (*.mof, *.mfl) do Mofcomp %i
Citrix:
c:
cd "C:\Program Files\Citrix\System32\Citrix\WMI"
for %i in (*.mof, *.mfl) do Mofcomp %i
Run the following commands:
winmgmt /clearadap
winmgmt /resyncperf
Restart the 
Windows Management Instrumentation service
If this does not resolve the issue reset WMI and repeat the above steps
c:
cd %windir%\system32\wbem\
net stop winmgmt
rmdir /s /q repository
rmdir /s /q Logs
mkdir Logs
net start winmgmt
 
References
Products
Microsoft Windows Server 2003 SP2
Citrix Presentation Server 4.5
Created: 16th September 2009
Updated: 8th November 2009
                    
                © 2005-2025 Jamie Morrison