1

I tried this Method (found on https://stackoverflow.com/a/31803247/2427812) on Windows 10 IoT Core [Version 10.0.15063] (Raspberry PI 3) to get the HardwareId but the result of GetId() changes every time the device restarts.
Do you have any idea why this should happen?

private static string GetId()
{
    if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.System.Profile.HardwareIdentification"))
    {
        var token = HardwareIdentification.GetPackageSpecificToken(null);
        var hardwareId = token.Id;
        var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);

        byte[] bytes = new byte[hardwareId.Length];
        dataReader.ReadBytes(bytes);

        return BitConverter.ToString(bytes).Replace("-", "");
    }

    throw new Exception("NO API FOR DEVICE ID PRESENT!");
}

0 Answers0