[C#] 纯文本查看 复制代码 ManagementClass mc = new ManagementClass("Win32_PhysicalMedia");
//Win32_DiskDrive不包含SerialNumber属性。
ManagementObjectCollection moc = mc.GetInstances();
string strID = null ;
foreach( ManagementObject mo in moc )
{
strID = mo.Properties["SerialNumber"].Value.ToString();
break;
}
textBox1.Text += "硬盘 ID:" + strID;
|