getDeviceID returns different values on the same device

Other discussions about CSPro
Post Reply
becklesd
Posts: 14
Joined: June 11th, 2012, 5:25 pm

getDeviceID returns different values on the same device

Post by becklesd »

There is a problem with getdeviceid() on my Windows 10 laptop in that it does not always return the same value. Over the last few days it has returned:
'00155d3c3d2e', '00155d6eb6da', '00155db5ac1b', '00155dd9c717'
The hardware has not changed over that time.
On Android the function behaves as expected.
Is there an alternative way of getting a unique identifier for a Windows machine?

Best regards
David Beckles
Gregory Martin
Posts: 1670
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: getDeviceID returns different values on the same device

Post by Gregory Martin »

If you only expect one person to log in on any given device, you could use the getusername function: https://www.csprousers.org/help/CSPro/g ... ction.html

However, that isn't purely unique because the person could be logged in on multiple machines.

The uuid function will return a unique value: https://www.csprousers.org/help/CSPro/u ... ction.html

Depending on your needs, you could generate a UUID, write it to a file on the Windows machine, and then read it back in to get the unique ID. This isn't perfect, as the ID would change it someone deletes the file, but if you trust your interviewers not to do this, this could be a decent workaround.
becklesd
Posts: 14
Joined: June 11th, 2012, 5:25 pm

Re: getDeviceID returns different values on the same device

Post by becklesd »

Hi Gregory,
Thanks for your reply. It's a good workaround, but I'll use savesetting/loadsetting instead of a file.
Any chance of getting a version of getdeviceID that works on Windows 10?

Best regards
Becklesd
aaronw
Posts: 531
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: getDeviceID returns different values on the same device

Post by aaronw »

On Windows the function returns the MAC address and Windows has an option to randomize it. The option is called "random hardware address." Any chance it is on?
becklesd
Posts: 14
Joined: June 11th, 2012, 5:25 pm

Re: getDeviceID returns different values on the same device

Post by becklesd »

In my case, no randomizing is not on. But the result returned seems to depend on the network connection and whether a VPN is in use.
Post Reply