I am working on a .NET Core application. My requirement is that i have to get the UUID of motherboard. Code is:
static void Main(string[] args)
{
string uuid = string.Empty;
ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
uuid = mo.Properties["UUID"].Value.ToString();
break;
}
Console.WriteLine("UUID : " + uuid);
Console.ReadKey();
}
This code works perfectly fine on windows machine but when i move to the linux machine, i get the following error:
Unhandled exception. System.PlatformNotSupportedException: System.Management currently is only supported for Windows desktop applications.
at System.Management.ManagementBaseObject..ctor(SerializationInfo info, StreamingContext context)
at System.Management.ManagementObject..ctor()
at System.Management.ManagementClass..ctor(String path)
at uniqueSystemId.Program.Main(String[] args)
Is System.Management not supported for linux ? If not, how can i get the UUID of motherboard on both linux and windows machine