Access Everest WMI

Status
Not open for further replies.

ghidu

Senior member
Feb 28, 2005
331
0
0
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?
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
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




 

Roy.Luo

Junior Member
Apr 23, 2013
2
0
0
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.