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