I need a installed total RAM in GB and also the CPU details as well. I see lot post related to this. But, I'm not sure which is suitable for me. And, also I tried with couple of examples but its not provided the expected result.
For example, I need like below,
RAM Size = 16 GB
CPU = Intel(R) Core(TM) i5 3.20 GHz 2 Cores
Note : I'm not expect the available or used memory.
Update :
To get the RAM details I used the below code
string Query = "SELECT MaxCapacity FROM Win32_PhysicalMemoryArray";
ManagementObjectSearcher searcher123 = new ManagementObjectSearcher(Query);
foreach (ManagementObject WniPART in searcher123.Get())
{
UInt32 SizeinKB = Convert.ToUInt32(WniPART.Properties["MaxCapacity"].Value);
UInt32 SizeinMB = SizeinKB / 1024;
UInt32 SizeinGB = SizeinKB / (1024 * 1024);
Console.WriteLine("Size in KB: {0}, Size in MB: {1}, Size in GB: {2}", SizeinKB, SizeinMB, SizeinGB);
}
But, This gave me wrong Data(Infact, it give 32 GB instead of 16GB)