views:

2938

answers:

9
+5  Q: 

CPU serial number

How do I obtain the serial number of the CPU in a PC?

A: 

You can use CPUID command.

aku
+1  A: 

Use the CPUZ tool: http://www.cpuid.com/cpuz.php

Bruce
Since this is a programming site, i would suspect he is asking about how to programmatically get the serial number. He used licensing tag which suspects that he is going to use it to create serial-numbers for his application.
Espo
Good point - the question could be clearer.
Bruce
A: 

Some more details please: operating system, language.

For example on Windows you can get it by using WMI and reading Win32_Processor.ProcessorId.

Biri
That is for information about processor's features.
icelava
Yes, and ProcessorId is some kind of (semi) unique identifier for the processor.
Biri
+1  A: 

I guess quite a few compiler do offer some wrapper or the like around the mentioned command. Here's an example

#include <stdlib.h>
#include <string.h>
#include <intrinsics.h>

_CPUID cpuinfo;
int main(void) {
_cpuid(&cpuinfo);
printf("Vendor: %s\n", cpuinfo.Vendor);
return 0;
}

Output:

Vendor: GenuineIntel
Friedrich
This is not a serial number.
shoosh
cpuinfo undefined?
0xC0DEFACE
It was an example of an intrincis, which e.g lcc-win32 offers. It's not standard. And you have to linke against the proper libraries.
Friedrich
+2  A: 

Remember that most computers these days ship with CPU ID disabled in the BIOS. See CPUID on Wikipedia

Redbeard
A: 

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.

Patrick_O
A: 

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.

Sqeaky
+4  A: 

Based upon 'licensing' tag you have used for your question, you might get better results reading network MAC address. Identifying PC by a MAC address isn't totally unbreakable method for copy protection, still it is sometimes used.

Sergey Volegov
+2  A: 

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!

Makar
Very nice indeed. Thank you
selwyn
returned the text "System Serial Number" for me on my i7. Do you have the link to the mentioned knowledge base article?
0xC0DEFACE