I am trying to get an unique CPU ID

坚强是说给别人听的谎言 提交于 2019-12-04 15:06:29

Maybe the UUID property of the Win32_ComputerSystemProduct object will suit your needs. It is supposed to be unique per-motherboard, as long as the manufacturer configures it in the first place. It's not too common for the CPU to move around without the motherboard coming along for the ride, anyways.

user613326

I came to the conclusion that this is just not a good method to get unique ID's. So instead of this method, I wrote a much larger piece of code in which I requested much more hardware identifiers of the system to build an unique identifier.

Its way better as this method would even produce different numbers if I would run it on cloned hardware, or if hardware gets changed. There is a lot of WMI info around and I think that's the place where people should look for creating something unique and not use ProcessorID.

try

ManagementClass managClass = new ManagementClass("win32_processor");
ManagementObjectCollection managCollec = managClass.GetInstances();

foreach (ManagementObject managObj in managCollec)
{
    cpuInfo = managObj.Properties["processorID"].Value.ToString();
    break;
}

working fine here...

Although there is a clear machine instruction to ask CPUID of a CPU, this is not guaranteed to return a unique ID, therefore it is virtually impossible to get a universal unique CPUID no matter which method you use. We examined the low level assembly routines and get the same id for two different AMD cpus.

Prashant Chavan
    var mbs = new ManagementObjectSearcher("Select ProcessorID From Win32_processor");
    var mbsList = mbs.Get();

    foreach (ManagementObject mo in mbsList)
    {
        cpuid = mo["ProcessorID"].ToString();
        textBox1.Text=cpuid;
    }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!