-1

I am searching for the unique Identifier of the device i.e. PC. I have looked to many links on Stack Overflow and other websites and found to generate UUID instead of mac id. But I also found that UUID may not be associated with some motherboards and may not work sometimes.

I have implemented the MAC ID as unique identifier but now I think this may not work very accurately as user's laptop may be sometime connected on LAN, wifi or dongle. And at every time I need to know unique identifier of the machine. Also I am concerned when I need unique identifier when user is connected using Virtual Box.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • This sounds like more a hardware question than a programming question – OneCricketeer Mar 03 '16 at 13:41
  • What do you mean by "UUID may not be associated with some motherboards"? If you are talking about software running on those PCs, you could generate an identifier, store it in a file and use that identifier everytime. – f1sh Mar 03 '16 at 13:43
  • Well thanks for the quick reply. When i generate the unique ID on machine and store it.Then it can be used on any other machine if that file is transferred to that machine – Ravi Brahmbhatt Mar 03 '16 at 14:05

1 Answers1

1

Interfaces doesnt get removed if you use one or another. Just loop NetworkInterface.getNetworkInterfaces() and check if one has the same MAC you registered.

The problem could be if you use a interface the is not integrated into the computer. Say a dongle which can be removed. Perhaps save all MAC adresses and check if any of them is present. Though then you can move a dongle to another computer and still get a yes.

If you want to really identify by windows uuid you can use the cmd command:

wmic csproduct get UUID

In java use Runtime.exec("wmic csproduct get UUID"); And then read the output with the outputstream of the Process and store it. I havent tested it but it should work.

Caspar Noree
  • 102
  • 1
  • 8
  • Thanks for answer casper.I implemented your solution and it is working nice.Just want to confirm that it will work same unique way if i have installed virtual box on PC or i am using other os than windows. – Ravi Brahmbhatt Mar 03 '16 at 14:26
  • It will not work if you use another os! Or if you use a virtual machine! Its bound to the windows you have installed on your computer. – Caspar Noree Mar 03 '16 at 16:07
  • That is presumed you use the command way. Network MAC ID is fine – Caspar Noree Mar 03 '16 at 16:57
  • I solved the issue using UUID for all the three platforms.. windows,linux and mac.I think UUID is also unique for the virtual box installed on the machine.So it is working as unique identifier.Thanks. – Ravi Brahmbhatt Mar 04 '16 at 11:21
  • what command you're executing in linux to obtain the similar output as the command above @RaviBrahmbhatt ? – gumuruh Jan 26 '17 at 14:47