public static void GetHDIndex() { string _HDInfo = ""; ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection moc1 = cimobject1.GetInstances(); foreach (ManagementObject mo in moc1) { _HDInfo = (string)mo.Properties["Model"].Value;
} retrun _HDInfo; }//获取网卡硬件地址 public static void GetMacAddress() { string _MacAddress = ""; ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc2 = mc.GetInstances(); foreach (ManagementObject mo in moc2) { if ((bool)mo["IPEnabled"] == true) MacAddress = mo["MacAddress"].ToString(); mo.Dispose(); } return _MacAddress; }