views:

43

answers:

1

I'm looking to produce a unique ID for some embedded systems I manage. The systems are running Windows Embedded 7 Standard and .NET 4.0. The IDs must:

  • Be relatively unique -- each embedded system is running on the same motherboard, drive, etc. and I can't have collisions.
  • Persist across reinstalls -- these computers get reimaged with new versions of our software regularly.
  • Cannot rely on the disk serial number -- we're not using real disks, but rather CF cards with a CF to SATA adapter, and the CF cards are swapped out occasionally.

Also, I have multiple NICs in the machine, so relying on the on-board NIC MAC address will work only if someone can tell me how to identify which NIC is on-board vs a USB device.

What's the best way to accomplish this?

+2  A: 

I suggest you use WMI to obtain information about the machine's CPU, using the Win32_Processor class. Then you can construct a unique id for the machine from attributes such as ProcessorId and UniqueId.

This way you would be using each machine's CPU itself as the persisten "store" for the machine id.

CesarGon
According to http://stackoverflow.com/questions/1101772/win32-processoris-processorid-unique-for-all-computers, the `ProcessorId` isn't unique across all PCs.
David Pfeffer
That's why you need to combine it with UniqueId. Basically, ProcessorId gives you the CPU's model or feature set, and UniqueId is unique within a given model or feature set. A combination of both is apparently guaranteed to be unique across machines.
CesarGon