Exception when reading BIOS information - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Exception when reading BIOS information

alexschunkalexschunk Posts: 4Member
Hello,

i got an Exception when i try to read some BIOS informaiton with WMI using C#.

I have the following code:

public static string GetBIOSBuildName()
{
string name = "";
try
{

ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_bios");
ManagementObjectCollection qCollection = query.Get();
foreach (ManagementObject mo in qCollection)
{
if (name == null)
{
name = mo["BuildName"].ToString();
}
}
}
catch (Exception e)
{
return "error";
}
return name;
}

It looks like i cannot read the BuildNumber and some other information but i can read BuildVersion, Caption and Language.

Do i need some other code for reading BuildNumber etc?

Thank you.
Sign In or Register to comment.