I need to get information about how much total RAM and how much virtual memory. And also how much virtual memory and RAM is currently used by the system, as in Task Manager. At the moment, I just figured out how to get the total amount of RAM, I have difficulties with the rest
ObjectQuery wql = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(wql);
ManagementObjectCollection results = searcher.Get();
double totalMemory = 0;
foreach (ManagementObject item in results)
{
var res = Convert.ToDouble(item["TotalVisibleMemorySize"]);
totalMemory = Math.Round((res / 1024), 2);
}