• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Access Everest WMI

Status
Not open for further replies.

ghidu

Senior member
I've been trying to read the Everest WMI with C# without any success.
This is part of the code (just an example):
SelectQuery query = new SelectQuery(@"Select * from Root\WMI\EVEREST_SensorValues");
ManagementObjectSearcher wmiSearcher = new ManagementObjectSearcher(query);
ManagementObjectCollection collection = wmiSearcher.Get();
foreach (ManagementObject obj in collection)
{
string id = obj["ID"].ToString();
}
I get an "Invalid query" in foreach.
Can anyone help?
 
Are you sure you have the path correct?
I haven't used the Everest WMI so I don't know what its namespace is, but try something like:


@"Select * from EVEREST_SensorValues"
Or
@"SELECT * FROM \\ComputerName\root\WMI:EVEREST_SensorValues"


To help find the right path use the WBEMTEST tool
just do start run wbemtest

Or try the Management class

// Get the WMI class
ManagementScope s =
new ManagementScope(@"\\MyBox\root\WMI");
ManagementPath p = new ManagementPath("EVEREST_SensorValues");
ObjectGetOptions o = new ObjectGetOptions(
null, System.TimeSpan.MaxValue, true);
ManagementClass c = new ManagementClass(s, p, o);

c.GetInstances(); //here is the collection of objects to loop through




 
This thread is over five years old. If you want to try to contact the OP send a private message. Posted email address removed.

Markbnj
Programming mod
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top