What is the best unique computer identifier?

I have been trying to find out what is the best way to uniquely identify a computer for licensing purposes.

Here are some suggestions.

Computer SID

In a previous post “Read computer sid on 64-bit machine” I show how to get the Product ID of the operating system as the unique identifier.

Cons
This seemed great and I even used it for a licensing tool until I installed the software on multiple virtual machines!
The VM’s were cloned from the same base image and guess what? They all had the same Product ID, which meant that every computer passed in the same ID.

Network Card Mac address and other hardware items

These do provide a level of uniqueness but there are a few problems:

Cons

  1. Most computers these days have many network cards, USB wi-fi etc, so which card do you choose to get the MAC address from?
  2. Unless it’s in a laptop or onboard, NIC’s can easily be replaced.

What is the best unique computer identifier

Thinking logically you want to use an identifier that is likely to change the least so CPU’s, NIC’s, Hard Drives etc etc should all be rejected.

The one component that generally doesn’t change very often is the motherboard. The motherboard has a UUID (Univerally Unique Identifier), that can be read from the bios.

This value is unique in both physical computers and Virtual Machines.

The following code sample is a c# example of how to read the UUID from the motherboard BIOS using the System.Management.ManagementClass to read the Win32_ComputerSystemProduct

[csharp]
using System.Management;


public static string UUID
{
get
{
string uuid = string.Empty;

ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct");
ManagementObjectCollection moc = mc.GetInstances();

foreach (ManagementObject mo in moc)
{
uuid = mo.Properties["UUID"].Value.ToString();
break;
}

return uuid;
}
}
[/csharp]

Note for a full reference of all the Win32 Management classes go here:
MSDN Win32 Classes

2 thoughts on “What is the best unique computer identifier?

  1. Great article!

    I am already using UUID of main harddisk but I think motherboard is more lasting than harddisk so I am thinking of switching to motherboard UUID for identification in software licensing.

    Could you tell me whether some unbranded motherboards might not have UUID?

    Thanks in advance for your assistance.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.