ibcadmin 发表于 2015-5-9 09:21:49

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;

页: [1]
查看完整版本: c#获取硬盘编号