Retrive the CPU type and CPU speed

Description :

This code shows how we can retrive the CPU type and CPU speed by running the
following code.

using System;
using Microsoft.Win32;

class Class1
static void Main(string[] args)
RegistryKey MyRegistryKey = Registry.LocalMachine;
MyRegistryKey = RegistryKey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
Object cpuSpeed = RegistryKey.GetValue("~MHz");
Object cpuType = RegistryKey.GetValue("VendorIdentifier");
Console.WriteLine("You have a {0} running at {1} MHz.",cpuType,cpuSpeed);


Author: satya31 Jul 2009 Member Level: Gold   Points : 0

It is really good.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: