How to obtain motherboard and processor unique identifiers in Mono under Linux?
Note: .Net namespace System.Management has no counterpart in Mono
How to obtain motherboard and processor unique identifiers in Mono under Linux?
Note: .Net namespace System.Management has no counterpart in Mono
I see two potential ways:
The typical approach from the command line is using dmidecode or lshw, which read the BIOS DMI area, and parse the serial numbers. However, this won't work if your application doesn't run as root, since it needs to be able to read /dev/mem.
You can get some of this information through HAL. I'm not entirely sure how to do this through HAL directly, but you can do it through the lshal command. Under one of the devices shown, you should see an entry for "system.hardware.serial" and "system.hardware.uuid" - those are the motherboard's serial number and UUID.
You can query HAL from Bash like this:
PC=`hal-find-by-property --key info.product --string Computer`
PC_UUID=`hal-get-property --udi $PC --key system.hardware.uuid`
PC_SERIAL=`hal-get-property --udi $PC --key system.hardware.serial`
On older machines, those keys might be "smbios.system.uuid" and "smbios.system.serial" instead. Also, be aware that this information may not exist on all machines, or make be entirely fake. I have at least one motherboard here with a UUID consisting entirely of 1's, and another with a CPU serial number that's almost entirely zeroes.