C# 获取本机CPU,硬盘等信息

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

public string getCpuInfo()  //读取CPU信息
        {
            ManagementClass mobj = new ManagementClass("Win32_Processor");
            ManagementObjectCollection moc = mobj.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                return mo.Properties["ProcessorId"].Value.ToString();
            }
            return "";
        }
        public string getHddInfo()  //读取硬盘信息
        {
            ManagementClass mobj = new ManagementClass("Win32_PhysicalMedia");
            ManagementObjectCollection moc = mobj.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                return mo.Properties["SerialNumber"].Value.ToString();
            }
            return "";
        }