Maybe the easiest way is.
Get the DeviceId Nuget package
And use it like
string deviceId = new DeviceIdBuilder()
.AddMachineName()
.AddMacAddress()
.AddProcessorId()
.AddMotherboardSerialNumber()
.ToString();
You can personalize the info used to generate the ID
Github Project
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…