C#

Get motherboard ID – Serial number with C#

To get motherboard id we have to use the class ManagementObjectSearcher. To use this class we have to add a reference to System.Management namespace.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public String getMotherBoardID()
{
	String serial = "";
	try
	{
		ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard");
		ManagementObjectCollection moc = mos.Get();
 
		foreach (ManagementObject mo in moc)
		{
			serial = mo["SerialNumber"].ToString();
		}
		return serial;
	}
	catch (Exception) { return serial; }
}