Identifying the CPU architecture type using C#
public String GetCpuArchitecture()
{
	ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT Architecture FROM Win32_Processor");
	ManagementObjectCollection moc = mos.Get();
	ManagementObjectCollection.ManagementObjectEnumerator moe = moc.GetEnumerator();
	moe.MoveNext();
	ushort arch = (ushort)moe.Current["Architecture"];
 
	switch (arch)
	{
		case 0:
			return "x86";
		case 1:
			return "MIPS";
		case 2:
			return "Alpha";
		case 3:
			return "PowerPC";
		case 6:
			return "Itanium";
		case 9:
			return "x64";
		default:
			return "Unknown Architecture";
	}
}
Categories: C# Tags: , , ,
%d bloggers like this: