Hi, I am having problems w/ WMI in C#.
1. I want to get the type of Hardware Abstraction Layer (HAL) of the current
system. I know it's in WMI "Win32_PnPEntity" class with
"DeviceID='ROOT\\ACPI_HAL\\0000'" and attribute "Caption". My code:
....
ManagementObjectSearcher Searcher = new ManagementObjectSearcher("SELECT
Caption from Win32_PnPEntity WHERE DeviceID='ROOT\\ACPI_HAL\\0000'");
ManagementObjectCollection Coll = Searcher.Get();
foreach(ManagementObject mo in m_WMIColl)
{
HAL = mo[Property].ToString();
break;
}
....
It fails when tries to get a ManagementObject (foreach loop). I ran the
query in WMI CIM Studio (from WMI SDK), it works just fine. Anyone knows why?
2. I am also trying to get the chassis type of the current system. This
info is stored in WMI "Win32_SystemEnclosure" class, attribute
"ChassisTypes". However ChassisTypes is an uint16 array. My code:
....
ManagementObjectSearcher Searcher = new ManagementObjectSearcher("SELECT
ChassisTypes from Win32_SystemEnclosure");
ManagementObjectCollection Coll = Searcher.Get();
foreach(ManagementObject mo in m_WMIColl)
{
// I don't know what goes here
break;
}
....
How do I get this uint16[]?
Please help, thank you.
-P