I need to generate a unique code from a single PC, my software will be distribute by licence, and locally I need to identify the environment and send this code to the server. I don't want to mantain on the server a sequencial number and each client recieve a number of the sequence, i tried to read the MAC adress from NetworkInterfaces, but is not secure, the user can change easily the MAC adress. The best way I think if its possible to read the motherboard serial number, but I haven't found the way until now. Any sugestion?
-
1Note also that the computer may have many network interfaces (and thus many MAC addresses), or none. – Michael Petrotta Aug 30 '10 at 01:04
-
Yes, but if the computer has no network interface I'm not able to retrieve the number. – Rigoni Aug 30 '10 at 01:11
-
Are you committed to writing your own licensing scheme? I think there are some decent open source solutions out there. – Arnold Spence Aug 30 '10 at 01:20
-
Create a long random string on installation and store it on the local machine? – Carsten Aug 30 '10 at 01:21
-
@Rigoni: I'm dating myself here, but look into PPP and the weirdness around MAC addresses. You can have an Internet connection without a physical network adapter. – Michael Petrotta Aug 30 '10 at 01:25
-
See related http://stackoverflow.com/questions/1986732/how-to-get-a-unique-computer-identifier-in-java-like-disk-id-or-motherboard-id – gawi Aug 30 '10 at 01:38
-
Also note that the MAC address can change is the user swaps out of disables the NIC. – Steve Kuo Aug 30 '10 at 01:42
2 Answers
How much is your software worth ?
Does the target market pirate software a lot ?
Motherboard serial number reading is possible on Windows boxes using WMI
Use WMI to read serial number http://www.c-sharpcorner.com/UploadFile/GemingLeader/mb-sn-wmi08242009101325AM/mb-sn-wmi.aspx
Use WMI from Java http://henryranch.net/software/jwmi-query-windows-wmi-from-java/
WMI is/was a broken on Windows XP domain members on a AD Domain, if they use group policies.
( This only effects most corporate users of XP, so not a big deal)
Hope this helps a bit ( MAC address is simpler... but is easy to change)

- 3,705
- 24
- 37
-
Yes, is a strategy software like a cassino calculator strategy. Is multiplatform, for windows this solution will be useful, but to another platforms no. I will try this solution, and to anothers OS others solutions. Many tanks. – Rigoni Aug 30 '10 at 01:47
-
1Could you elaborate a little on how WMI is/was broken. I've been unable to find a reference to this bug. – MZB Aug 30 '10 at 02:56
-
There are numereous areas where WMI just flat doesn't report back the information you expect. Compounding this is that each and every service pack (and an unfortunate number of regular updates) has made changes to what WMI does report. Unless you have very strict control over what's installed at the client, WMI can be maddening to work with. – NotMe Feb 06 '11 at 05:00
-
AFIAK make a XP machine part of an AD domain apply some group policies and bingo, WMI doesn't work (specifically for many app installers). – Tim Williscroft Feb 06 '11 at 22:41
The MAC address is not reliable. You should aim for something that cannot be change such a CPU ID or HDD IDE ID. Here is want I mean: http://www.soft.tahionic.com/download-hdd_id/index.html
Unfortunately I don't think that DLL is working with Java, but at least it will show you some info about what is reliable and what is not.

- 20,797
- 27
- 159
- 293
-
The CPU ID doesn't give you a unique serial number. That ID is purely for identifying the exact TYPE of processor in use. – NotMe Feb 06 '11 at 05:01
-
1Also, the hard drive one is unreliable as it may not be available due to usage of RAID controllers – NotMe Feb 06 '11 at 05:02