private static string GetMAC()
{
ManagementClass mc;
ManagementObjectCollection moc;
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
moc = mc.GetInstances();
string MAC = string.Empty;
foreach (ManagementObject mo in moc)
{
if ((bool)mo["IPEnabled"] == true)
{
MAC = mo["MacAddress"].ToString();
}
}
return MAC;
}
private static string GetDisk()
{
ManagementObject disk;
disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
return disk.GetPropertyValue("VolumeSerialNumber").ToString();
}
//CPU序列号
private static string GetCPU()
{
string CPU = null;
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
CPU = mo.Properties["ProcessorId"].Value.ToString();
break;
}
moc = null;
mc = null;
return CPU.Trim();
}
ok
mjj通道