I’m trying to list all of the available fields on a WMI Class using C#.
The closest I’ve got is listing all of the available equivalent of tables in WMI
ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from meta_class");
foreach (ManagementClass wmiClass in searcher.Get())
{
Console.WriteLine(wmiClass["__CLASS"].ToString());
}
However it appears there is no equivalent of this for the fields.
Is this possible or is it just a case of looking up the reference manual to see all of the available fields?
If you have an instance of the WMI class, then
System.Management.ManagementBaseObject.Propertiesis a listing of all the properties (WMI doesn’t separate properties and fields – being based on COM they’re all properties).ManagementClassderives fromManagementBaseObjectso it also has aPropertiesproperty listing the properties of the WMI class, so to list all the properties:(Each element of the
Propertiescollection is aPropertyDatainstance with lots of information about each property.)