1.主板序列号获取
.net c# 通过 ManagementObjectSearcher 类查询Win32_BIOS 获取主板序列号信息
/// <summary>
/// 获取主板序列号
/// </summary>
/// <returns></returns>
public string GetBIOSSerialNumber()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * From Win32_BIOS");
string sBIOSSerialNumber = "";
foreach (ManagementObject mo in searcher.Get())
{
sBIOSSerialNumber = mo["SerialNumber"].ToString().Trim();
}
return sBIOSSerialNumber;
}
catch
{
return "";
}
}
2.主板制造厂商
.net c# 通过 SelectQuery 类查询Win32_BaseBoard 后,提取 Manufacturer 信息,该信息即为主板制造厂商
/// <summary>
/// 主板制造厂商
/// </summary>
public string GetBoardManufacturer()
{
SelectQuery query = new SelectQuery("Select * from Win32_BaseBoard");
ManagementObjectSearcher mos = new ManagementObjectSearcher(query);
ManagementObjectCollection.ManagementObjectEnumerator data = mos.Get().GetEnumerator();
data.MoveNext();
ManagementBaseObject board = data.Current;
return board.GetPropertyValue("Manufacturer").ToString();
}
3.主板编号
.net c# 通过 ManagementObjectSearcher 类查询Win32_BaseBoard后,提取 SerialNumber 信息,该信息即为主板编号
/// <summary>
/// 主板编号
/// </summary>
public string GetBoardID()
{
string st = "";
ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * from Win32_BaseBoard");
foreach (ManagementObject mo in mos.Get())
{
st = mo["SerialNumber"].ToString();
}
return st;
}
4. 主板型号
.net c# 通过 ManagementObjectSearcher 类查询Win32_BaseBoard后,提取 Product 信息,该信息即为主板型号
/// <summary>
/// 主板型号
/// </summary>
public string GetBoardType()
{
string st = "";
ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * from Win32_BaseBoard");
foreach (ManagementObject mo in mos.Get())
{
st = mo["Product"].ToString();
}
return st;
}
运行结果: