'Where do Windows "Product ID" and "Device ID" values come from? Are they useful for Licensing/Identification? How can they be accessed in code?

Screenshot of Windows 10 Settings -> System -> About

As you can see, it has 2 "Hardware-Identity" values that could be very useful in applications like C# for license validating. Is it possible to find these values/compute them manually?

Is it possible it's stored in Registry and is it only for Windows 10?
This is windows Version 1709 Build 16299.15.



Solution 1:[1]

  1. The Device ID (Advertising ID) is a distinctive number associated with a device. This number is important for technicians and engineers when trying to find solutions to ongoing issues. And it will change if you reset or install new Windows.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQMClient
    

    Device ID

  2. The Product ID is the number associated with your particular operating system. It may change if you install cracked Windows or active Windows with Third-Party activation software.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
    

    Product ID

Solution 2:[2]

for "Product ID" you can use wmic

cmd com:

wmic os get serialnumber

C# code:

  private string get_com_cmd(string com)
    {
        var processInfo = new ProcessStartInfo("cmd.exe", "/c "+com)
        {
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardError = true,
            RedirectStandardOutput = true,
            WorkingDirectory = @"C:\Windows\System32\"
        };

        StringBuilder sb = new StringBuilder();
        Process p = Process.Start(processInfo);
        p.OutputDataReceived += (sender, args_) => sb.AppendLine(args_.Data);
        p.BeginOutputReadLine();
        p.WaitForExit();

        return sb.ToString();
    }

the call:

   Console.WriteLine(get_com_cmd("wmic os get serialnumber"));

EX cmd output enter image description here

for "Device ID" you can use reg query in cmd or open registry editor by typing the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQMClient your device id in (MachineId) name.

useing cmd by typing

reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQMClient /v MachineId

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chayan Mistry
Solution 2