I'm running the following code in attempt to get the ChassisType of the device it is run on.
string wmiQuery = string.Format(
"SELECT ChassisTypes FROM Win32_SystemEnclosure");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);
foreach (ManagementObject obj in searcher.Get())
When I run this, and try to convert it to string, it gives me an empty string. When I try and examine what the searcher.get() is returning in Autos. It gives me an evaluation time out and then an exception... If I just let it run it does actually return
I'm ignoring the evaluation because I get the same exception when i try and examine other WMI queries and I know they work and return the required values. I also dont know where to start with this, although it is hindering troubleshooting.
I think the problem is that the ChassisTypes property is an array... but I've no idea how to get the value out. I cant run another foreach on my "obj" managementobject, because managementobjects do have a GetEnumerator.
Any ideas on how to 1. sort the evaluation time out... or even better 2. access WMI array properties.
Cheers