I am trying to populate a few textboxes in a windows form using the values stored in the properties of the Win32_OperatingSystem. I am using a windows 7.
The following is the code I am using
ArrayList prName = new ArrayList();
ArrayList prValue = new ArrayList();
int i = 0;
ManagementClass msClassOS = new ManagementClass("Win32_OperatingSystem");
msClassOS.Options.UseAmendedQualifiers = true;
PropertyDataCollection properties = msClassOS.Properties;
foreach (PropertyData property in properties)
{
prName.Add(property.Name);
}
foreach (PropertyData property in properties)
{
prValue.Add(new string[] { msClassOS.GetPropertyValue("Value").ToString() });
}
The following is the exception I am getting -
System.Management.ManagementException: Not found
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.PropertyData.RefreshPropertyInfo()
at System.Management.PropertyDataCollection.get_Item(String propertyName)
at System.Management.ManagementBaseObject.GetPropertyValue(String propertyName)
at NetworkMonitoringSoftware.Form1.tabControl1_Selected(Object sender, TabControlEventArgs e) in C:\Users\OWNER\Documents\Visual Studio 2010\Projects\NetworkMonitoringSoftware\NetworkMonitoringSoftware\Form1.cs:line
Can you tell me what the exception is and how I can overcome it?
Thanks in advance.