Home > c#, Code > What is the best unique computer identifier?

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.

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:


  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

using System.Management;
public static string UUID
        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();

        return uuid;

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

VN:F [1.9.22_1171]
Rating: 9.7/10 (11 votes cast)
What is the best unique computer identifier?, 9.7 out of 10 based on 11 ratings

Categories: c#, Code Tags:
  1. February 19th, 2013 at 20:09 | #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.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  2. jcrawfor74
    February 20th, 2013 at 00:48 | #2

    A quick google gave me an answer.
    “Not all vendors supply a UUID”
    I would still think the motherboard is a pretty safe option. Alternatively you could try the motherboard and have a second object like CPU as a fallback?

    VN:F [1.9.22_1171]
    Rating: +1 (from 1 vote)
  1. No trackbacks yet.