C # Read Computer CPU,HDD information

Source: Internet
Author: User

        public string Getcpuinfo ()//Read CPU information {ManagementClass mobj = new ManagementClass ("Win32_processo            R "); Managementobjectcollection MOC = mobj.            GetInstances (); foreach (ManagementObject mo in moc) {return mo. properties["Processorid"].            Value.tostring ();        } return ""; } public string Gethddinfo ()//read hard disk information {ManagementClass mobj = new ManagementClass ("win32_physical            Media "); Managementobjectcollection MOC = mobj.            GetInstances (); foreach (ManagementObject mo in moc) {return mo. properties["SerialNumber"].            Value.tostring ();        } return ""; }//Gets the volume label of the device hard disk public string Getdiskvolumeserialnumber () {ManagementClass MC = new Managemen            Tclass ("Win32_NetworkAdapterConfiguration");       ManagementObject disk = new ManagementObject ("win32_logicaldisk.deviceid=\" D:\ "");     Disk.            Get (); return disk. GetPropertyValue ("VolumeSerialNumber").        ToString ();            }//Gets the serial number of the CPU public string Getcpu () {string strcpu = null;            ManagementClass mycpu = new ManagementClass ("Win32_Processor");            Managementobjectcollection mycpuconnection = Mycpu.getinstances (); foreach (ManagementObject myObject in mycpuconnection) {strcpu = myobject.properties["Processor ID "].                Value.tostring ();            Break        } return STRCPU;        }

C # Read Computer CPU,HDD information

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.