Forum Discussion

ChrisPro's avatar
ChrisPro
Contributor
11 years ago

RAM and processor information

Hello, I would like to display in log :  - RAM information  - processor information Thanls for your answer.
  • HKosova's avatar
    11 years ago
    Hi Chris,



    For CPU information, use Sys.CPU and Sys.CPUCount.



    For the memory size, use the WMI class Win32_PhysicalMemory. You'll need to sum the Capacity property values of all class instances:



    function PrintTotalMemoty()

    {

      var oWMI = GetObject("winmgmts:");

      var memSize = 0;

      var colItems = oWMI.ExecQuery("SELECT Capacity FROM Win32_PhysicalMemory");

      var enumItems = new Enumerator(colItems);

      for ( ; !enumItems.atEnd(); enumItems.moveNext())

      {

        memSize += aqConvert.StrToFloat(enumItems.item().Capacity);

      }

      Log.Message("Total physical memory: " + VarToStr(memSize) + " bytes");

    }