CPU序列号
如何获取PC中CPU的序列号?
How do I obtain the serial number of the CPU in a PC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何获取PC中CPU的序列号?
How do I obtain the serial number of the CPU in a PC?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(14)
我在没有任何外部库的情况下得到了最终的答案。 只需输入以下内容:
wmic BIOS get Serialnumber
这将为您提供 PC 机箱上的序列号;)
(可在微软知识库中找到)
问候!
I have the ultimate answer for this without any external libraries. Simply type this:
wmic bios get serialnumber
This will give you the Serial Number on the PCs chassis ;)
(found in microsoft's knowledge base)
Regards!
Intel CPU 中 Pentium III 之后没有 CPU 序列号(PSN;CPUID edx 位 18“psn”处理器序列号); AMD 芯片中从来没有任何 psn:
https://software .intel.com/en-us/forums/watercooler-catchall/topic/308483(2005 年)
https://en.wikipedia.org/wiki/Pentium_III #Controversy_about_privacy_issues
https://en.wikipedia.org/wiki/CPUID #EAX=3:_Processor_Serial_Number
There is no CPU serial ID (PSN; CPUID edx bit 18 "psn" Processor Serial Number) after Pentium III in Intel CPUs; and there was never any psn in AMD chips:
https://software.intel.com/en-us/forums/watercooler-catchall/topic/308483 (at 2005)
https://en.wikipedia.org/wiki/Pentium_III#Controversy_about_privacy_issues
https://en.wikipedia.org/wiki/CPUID#EAX=3:_Processor_Serial_Number
即使启用了 CPUID,现代处理器中实际上还有可用的序列号吗? 我记得当整个序列号问题被提出时,Pentium 3 引起了强烈的抗议。
Even with CPUID enabled is there actually a serial number available in modern processors? I remember there being a big outcry in the Pentium 3 days when this whole serial number issue was raised.
这是旧线程。 但我遇到了同样的问题,但我得到了以下逻辑,没有太多的“如果”、“与”或“但是”。
CPU序列号的问题是它并不总是在虚拟化环境中工作。
我对一组基于 Windows 的服务器执行了以下逻辑:
Win32_BIOS
可以为您提供 BIOS 的序列号。 我们需要记住,如果系统是虚拟化的,您最终可能会为所有服务器提供相同的 BIOS 序列号。Win32_NetworkAdapter
可以为您提供一个您也可以使用的 MAC。 如果您有多个 NIC,您最终将获得多个 MAC。将这两个 ID 结合起来,我就拥有了跨越物理和虚拟的 6000 台服务器的全部唯一集。 使用
ManagementClass
& 实现起来非常简单。管理对象
。但需要注意的是:当您尝试远程获取
MO
实例时,在 <5 毫秒延迟的 10Gbps 光纤网络上将花费几秒钟以上的时间。 所以如果你算一下,我在单线程操作上花费了 3 个多小时。 由于这更像是低优先级流量,我不想向我的网络发送垃圾邮件以收集多线程调用上的WMI
数据。This is and old thread. But I had a same problem, but I got the following logic working without too many ifs, ands or buts.
The problem with CPU serial number is that it does not always work in virtualized environment.
I did the following logic with a set of Windows-based servers:
Win32_BIOS
can provide you a serial number of the bios. We need to keep in mind that if the system is virtualized, you could end up with same bios serial number for all servers.Win32_NetworkAdapter
can provide you a MAC that you can use as well. In cases where you have multiple NICs, you will end up with multiple-MACs.Combining both these IDs, I had all unique set over a set of 6000 servers spanning across physical and virtual. This was really simple to implement using
ManagementClass
&ManagementObject
.But just a caveat: when you try to get the
MO
instance remotely, it'll take more than a few seconds on a <5ms latency 10Gbps optical network. So if you do the math it took me over 3 hours on a single thread operation. Since this is more like a low-priority traffic I didn't want to spam my network for gatheringWMI
data on multi-threaded call.请记住,现在大多数计算机在出厂时都在 BIOS 中禁用了 CPU ID。 请参阅 维基百科上的 CPUID
Remember that most computers these days ship with CPU ID disabled in the BIOS. See CPUID on Wikipedia
Ivy Bridge CPU 及更新版本均包含 PPIN(受保护的处理器识别号)。 计算机的固件可以阻止对此功能的访问。
https://lore.kernel.org/patchwork/patch/736614/
Ivy Bridge CPUs and newer all include a PPIN (Protected Processor Identification Number). Access to this feature can be blocked by the computer's firmware.
https://lore.kernel.org/patchwork/patch/736614/
使用正确的寄存器设置执行 CPUID 指令将检索 EAX、EBX、ECX 和 EDX 中的处理器序列号。 但是,此功能仅适用于 Pentium 3 及更高版本的处理器。 同样,在 Pentium 4 和更新的处理器上,该指令始终在所有 4 个寄存器中返回 0x00000000。 更高型号的 Pentium 3 也可能返回 0x00000000。 该功能主要旨在复制保护,允许软件链接到特定处理器。 它在社区中反响不佳,随之而来的是诉讼。 该功能已从最新型号 P3 和所有较新的处理器中删除。 出于兼容性原因,该功能出现在较新的处理器中。 据传,您可以特别订购具有序列号的处理器,btu 的最低购买量约为 100 万个处理器。 有关执行 CPUID 指令之前的具体寄存器设置,请通过其网站查看 Intel 的系统程序员 PDF。
还 -
Executing the CPUID instruction with the proper register settings will retrieve the processor serial number in EAX, EBX, ECX, and EDX. However, this functionality is only available on Pentium 3 and later processors. Also on Pentium 4 and newer processors the instruction always returns 0x00000000 in all 4 registers. Later model Pentium 3's may also return 0x00000000's. The feature was primarily aimed at copy protection, allowing software to be linked to specific processors. It did not go over well with the community, and lawsuits ensued. The feature was removed from late model P3's and all newer processors. The feature is present in newer processors for compatibility reasons. it is rumored than you can special order processors with serial numbers, btu the minimum purchase is something like 1 million processors. For the specific register settings prior to executing the CPUID instruction, check Intels system programmer PDF available through their website.
Also -
__get_cpuid (unsigned int __level, unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx);
#include
注意:处理器序列号是在 Intel Pentium III 上引入的,但出于隐私考虑,此功能在后续型号上不再实现。
来源:维基百科
__get_cpuid (unsigned int __level, unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx);
#include <cpuid.h>
Note: The processor serial number was introduced on Intel Pentium III, but due to privacy concerns, this feature is no longer implemented on later models.
Source : wikipedia
请提供更多详细信息:操作系统、语言。
例如,在 Windows 上,您可以通过使用 WMI 并阅读 Win32_Processor.ProcessorId。
Some more details please: operating system, language.
For example on Windows you can get it by using WMI and reading Win32_Processor.ProcessorId.
在Windows中,我确信有一个系统调用,在Linux中,人们可以尝试“sudo lshw”,但大多数内核似乎不支持CPU序列号,初步研究似乎表明,对唯一可识别计算机的普遍愤怒意味着有没有完美的答案。
你想做什么? 几乎可以肯定有人以前做过,重复使用或模仿他们所做的事情可能是明智的。
In windows, I am sure there is a system call, In linux one could try "sudo lshw" but most kernels do not seem to support CPU serial numbers, and preliminary research seems to indicate that the general outrage against uniquely identifiable computers means that there is no perfect answer.
What are you trying to do? Almost certainly someone has done it before and it may be wise to reuse or emulate what they have done.
使用 CPUZ 工具:http://www.cpuid.com/cpuz.php
Use the CPUZ tool: http://www.cpuid.com/cpuz.php
您可以使用 CPUID 命令。
You can use CPUID command.
我想很多编译器确实提供了一些包装器或类似的东西
命令。 这是一个示例
输出:
I guess quite a few compiler do offer some wrapper or the like around the mentioned
command. Here's an example
Output:
我的建议是获取 HDD/SSD 序列号,许多语言都支持此。
My suggestion is to get HDD/SSD serial number, many languages have support for this.