I am trying to run a wmi query using System.Management in c# and keep getting invalid class. It is for wmware virtual desktops using the pcoip protocol. I can use WMI Explorer and it shows like below.
Here is just some example c# code. I know its not using "using" statements I am just trying to keep it short. I have noticed if I select the top level namespace in WMI Explorer and try to run query it fails with same invalid class error and then if I click on ROOT\CIMV2 and run query it works fine. I have checked path in scope etc and it appears to be correct. I can't use Microsoft.Management.Infrastructure as well.
var scope = new ManagementScope(ManagementPath.DefaultPath);
var query = new SelectQuery("SELECT * from Win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics");
scope.Connect();
var searcher = new ManagementObjectSearcher(scope, query);
var collection = searcher.Get();
Note I can use powershell and retrieve using
Get-WmiObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics"
UPDATE: Strange but I noticed I can see in WMI Explorer but if using WMI Code Creator I do not see.