Lately, I ran into an issue, trying to identify the uniqueness of machines across platforms. Suffice to say, it’s a lot complicated than what I initially thought.
The traditional method of leverage the MAC address as the computer’s unique identifier is not going to work anymore. Why? Because each computer can easily have multiple MAC addresses from multiple network adapter. For example, almost all laptops come with one Ethernet, one Wi-Fi network adapters, and one Bluetooth. The MAC address quickly changes every time when your computer connects from a wired network to a wireless network. Moreover, the MAC address even changes when you are on or off a VPN connection. Not to mention when it’s running on a virtual machine. With that, the days of using the MAC address as a unique identifier of a computer are gone.
Use UUID as the Identifier When You Can
We covered in the past that you can use the wmic command to find all the system info from your machine. And we can use the same too here.
wmic csproduct get UUID
That UUID is the best way to ID a machine, it exists in Windows, Mac and many other platforms. It is 32 characters in length, a universally unique identifier. You can run the above wmic command to get it.
But wait, that’s not always the case. Some of the motherboard vendors might not include this UUID in their motherboard, which is quite common on those non-OEM machines. In that case, when you use wmic trying to retrieve it you will get all FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF as the ID back.
In Windows, there are a couple of alternatives that you can use if UUID idea failed.
The first one is to use your Windows product ID. This is the ID you can retrieve easily from Control Panel > System and Security > System
But that doesn’t always guarantee the uniqueness of the machine. For example, on those Windows volume activated or none genuine Windows machines, the Product ID will always be the same. Also keep in mind that if you re-install Windows, this ID might change as well.
The second option is to use the hard drive’s serial number as a unique identifier. That’s almost the better approach if UUID fails, meaning that you can rely on the HDD’s serial number.
wmic DISKDRIVE get SerialNumber
The above command will do the trick. It even returns all of the numbers if you have multiple hard drives physically connected to your machine.
If you want to ID a machine, the old way of using the Mac address is not reliable anymore. There are better ways around. We only listed two options here and if you know any others, feel free to share them in the comment below.
/Update on July 17, 2015/
There is actually another way to uniquely identify each Windows PC. Open up Registry and navigate to
Find the key called “MachineGuid” this key is generated uniquely during the installation of Windows and it won’t change regardless of any hardware swap (apart from replacing the boot-able hard drive where the OS are installed on). That means if you want to keep tracking installation per OS this is another alternative. It won’t change unless you do a fresh reinstall of Windows.
/update on Jan 9, 2019/
You can run the following cmdlet in PowerShell console to get the UUID as well.
(Get-CimInstance -Class Win32_ComputerSystemProduct).UUID
/update on Sept. 15, 2020/
Windows 10 system can also be identified by a so-called 4K-Hash, a special hash string that is 4000 bytes in size. It is just one piece of information required to register Windows machines yet it may be interesting by itself to uniquely identify Windows operating systems for other purposes, too.
To identify, run the following command in an elevated PowerShell window:
(Get-CimInstance -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'").DeviceHardwareData