c# 获取 bios 序列号
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Management; using System.Diagnostics; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Debug.Print(getBiosSN()); } public static string getBiosSN() { ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_BIOS"); ManagementObjectCollection objects = searcher.Get(); foreach (ManagementObject obj in objects) { try { if (obj.GetPropertyValue("SerialNumber") != null) { return obj["SerialNumber"].ToString(); } } catch (Exception) { } } return string.Empty; } } }
桂棹兮兰桨,击空明兮溯流光。