文件名称:获取CPU及硬盘序列号
文件大小:1KB
文件格式:TXT
更新时间:2012-01-16 10:45:27
CPU,硬盘,序列号
获取CPU及硬盘序列号 string Cpu_ID = ""; string Hard_Driver = ""; try { ManagementClass mcCpu = new ManagementClass("win32_Processor"); ManagementObjectCollection mocCpu = mcCpu.GetInstances(); foreach (ManagementObject m in mocCpu) { Cpu_ID = m["ProcessorId"].ToString(); break; } } catch { Cpu_ID = ""; } try { ManagementObjectSearcher mcDisk = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia"); ManagementObjectCollection mocDisk = mcDisk.Get(); foreach (ManagementObject mm in mocDisk) { Hard_Driver = mm["SerialNumber"].ToString().Trim(); break; } } catch { Hard_Driver = ""; }