locked
Device identification values RRS feed

  • Question

  • Hello! I was not sure where to post this because it doesn't fit any of the suggested forum categories. I am looking for a way for my app to uniquely identify the devices which it runs on.

    Specifically, I need a value (probably a GUID, but any other string works, the format doesn't matter) which is unique for every Windows system (or has an infinitely small chance of being the same for 2 Windows systems) and is constant (so no other program changes it, it's generated once when the system is installed/set-up and stays the same).

    There are 2 values which I have been trying to find more information on and which seem to fit these requirements but I can't determine that yet.

    - One is stored in the Registry at \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography called MachineGUID. However, I have seen someone mention that this value is open and can easily be modified by any program that wishes to do so. This was on a forum so I don't give it much credence, but if anyone can confirm/deny that, I'd be much obliged. Any additional info on this value is also hugely appreciated. What is it used for? Can it be changed? Etc.

    - The other is the Device ID which is displayed in the Settings->System->About page (with the build number, device name, processor name, product id, etc.). It's very difficult to uncover more information about this particular number because "Device ID" gives so many various results when searched for just because it's such a universal term and can be applied to a lot of things. What is this the ID of exactly? How and when could it change? Most importantly, how do I retrieve it programmatically (using Win32 APIs or the .NET API namespaces)

    Friday, November 20, 2020 11:01 AM

All replies

  • Did you consider writing your own unique values to Registry?

    To get various information, you can use WMI. For example (in C#):

    var searcher = new ManagementObjectSearcher( "SELECT * FROM Win32_OperatingSystem" );
    ManagementObjectCollection objects = searcher.Get( );
    
    foreach( ManagementObject obj in objects )
    {
    	Console.WriteLine( $"SerialNumber: {obj["SerialNumber"]}" );
    	Console.WriteLine( $"InstallDate: {obj["InstallDate"]}" );
    }


    (Also add reference to System.Management) .

    There are various WMI classes related to hardware and software: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-provider.


    Saturday, November 21, 2020 9:23 PM