Question

I am writing an application on windows to get the information of Motherboard. The information I want to collect is

  • Motherboard Manufacturer (e.g. Dell or Gigabyte)
  • Motherboard Model (e.g. T3600 or GA-Z77)

Can anyone please tell me which API I should use to get this information?

Was it helpful?

Solution

this is the first answer as a thank u for this site frist add a System.Management refrence to your project and try this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            // First we create the ManagementObjectSearcher that
            // will hold the query used.
            // The class Win32_BaseBoard (you can say table)
            // contains the Motherboard information.
            // We are querying about the properties (columns)
            // Product and SerialNumber.
            // You can replace these properties by
            // an asterisk (*) to get all properties (columns).
            ManagementObjectSearcher searcher =
                new ManagementObjectSearcher("SELECT Product, SerialNumber FROM Win32_BaseBoard");

            // Executing the query...
            // Because the machine has a single Motherborad,
            // then a single object (row) returned.
            ManagementObjectCollection information = searcher.Get();
            foreach (ManagementObject obj in information)
            {
                // Retrieving the properties (columns)
                // Writing column name then its value
                foreach (PropertyData data in obj.Properties)
                    Console.WriteLine("{0} = {1}", data.Name, data.Value);
                Console.WriteLine();
            }

            // For typical use of disposable objects
            // enclose it in a using statement instead.
            searcher.Dispose();
            Console.Read();
        }
    }
}

hope that will help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top