xxxxxxxxxx
using System.Management;
string GetComputerSerialNumber()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BIOS");
ManagementObjectCollection collection = searcher.Get();
foreach (ManagementObject obj in collection)
{
return obj["SerialNumber"].ToString();
}
return "";
}
string serialNumber = GetComputerSerialNumber();
Console.WriteLine("Serial number: " + serialNumber);