我正在尝试获取唯一的CPU ID [英] I am trying to get an unique CPU ID

查看:135
本文介绍了我正在尝试获取唯一的CPU ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的代码来获取唯一的CPU ID,因此我在网上找到了各种示例。然而。碰巧我碰巧拥有2台Asus笔记本电脑。一个是四核i5,另一个是重型i7八核,都是64位计算机。
令我惊讶的是,它们都产生相同的唯一 CPU ID ??

I am using the code below to get a unique CPU ID, i found various samples on the web using this. However. By chance I happen to own 2 Asus Laptops. One is a quad core i5 the other an heavy duty i7 octocore both are 64 bit machines.. To my big surprise they both produce the same "unique" CPU ID ???.

所以此代码对我不起作用,是否有其他方法来获取唯一的CPU ID,或者我在这里做错了什么。我希望得到的是每个制造的CPU的具体数字

So this code isnt working for me, are there other methods to get unique CPU ids or do i do something wrong here. What I hope to get is a number that specific for each CPU that is made

string cpuID = string.Empty;
ManagementClass mc = new ManagementClass("win32_processor");
ManagementObjectCollection moc = mc.GetInstances();

foreach (ManagementObject mo in moc)
{
 if (cpuID == "")
 {
      //Remark gets only the first CPU ID
      cpuID = mo.Properties["processorID"].Value.ToString();

 }
}
return cpuID;


推荐答案

我得出的结论是,这不是一个获得唯一ID的好方法。
因此,我用这种方法代替了这种方法,而是编写了一段更大的代码,在其中我请求更多的系统硬件标识符来构建唯一标识符。

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.

它的方法更好,因为如果我在克隆的硬件上运行它,或者硬件发生更改,则该方法甚至会产生不同的数字。周围有很多WMI信息,我认为人们应该在这里创建独特的东西,而不使用ProcessorID。

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.

这篇关于我正在尝试获取唯一的CPU ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆