获取CPU序列号

public  string GetCPUSerialNo()

       {

           

           string cpuSerialNo = string.Empty;

           ManagementClass managementClass = new ManagementClass("Win32_Processor");

           ManagementObjectCollection managementObjectCollection = managementClass.GetInstances();

           foreach (ManagementObject managementObject in managementObjectCollection)

           {

               // 可能是有多个

               cpuSerialNo = managementObject.Properties["ProcessorId"].Value.ToString();

               break;

           }

           return cpuSerialNo;

       }

你可能感兴趣的:(cpu)