/// <summary>
/// 获取CPU序列号
/// </summary>
/// <returns></returns>
public static string GetProcessorSerialNumber()
{
string SerialNumberStr = "";
ManagementClass mana = new ManagementClass("Win32_Processor");
ManagementObjectCollection Moc = mana.GetInstances();
foreach (ManagementObject mo in Moc)
{
SerialNumberStr = mo.Properties["ProcessorId"].Value.ToString();///CPU序列号
}
return SerialNumberStr;
}
/// <summary>
/// 获取硬盘序列号
/// </summary>
/// <returns></returns>
public static string GetDiskDriveSerialNumber()
{
string SerialNumberStr = "";
ManagementClass mana = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection Moc = mana.GetInstances();
foreach (ManagementObject mo in Moc)
{
SerialNumberStr = mo.Properties["Model"].Value.ToString();///硬盘序列号
}
return SerialNumberStr;
}
/// <summary>
/// 获取网卡序列号
/// </summary>
/// <returns></returns>
public static string GetMACSerialNumber()
{
string SerialNumberStr = "";
ManagementClass mana = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection Moc = mana.GetInstances();
foreach (ManagementObject mo in Moc)
{
if (Convert.ToBoolean(mo["IPEnabled"]))
SerialNumberStr = mo["MacAddress"].ToString();///网卡序列号
//mo.Properties["MacAddress"].Value.ToString();
}
return SerialNumberStr;
}