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 address 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 MAC address as a unique identifier of a computer is 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 a 32 characters in length, 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 the 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 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