Please check the following code to read the ProcessorID:
public string GetMachineId()
{
string cpuInfo = String.Empty;
ManagementClass managementClass = new ManagementClass("Win32_Processor");
ManagementObjectCollection managementObjCol = managementClass.GetInstances();
foreach (ManagementObject managementObj in managementObjCol)
{
if (cpuInfo == String.Empty)
{
cpuInfo = managementObj.Properties["ProcessorId"].Value.ToString();
}
}
return cpuInfo;
}Note: You must add a reference of System.Management Assembly to use the above program.
No comments:
Post a Comment