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;