取得硬盘序列号
在调用前一定要手动在引用中加入System.Management.dll.
代码如下:
ManagementObjectSearcher search = new ManagementObjectSearcher("Select * from Win32_PhysicalMedia"); string strHardDiskID = null; foreach (ManagementObject mo in search.Get()) { strHardDiskID = mo["SerialNumber"].ToString().Trim(); break; } this.Text = strHardDiskID;