That code is using WMI to get info about Win32_PhysicalMemoryArray
in Windows.
See the raw results using this query:
selects "* from Win32_PhysicalMemoryArray" of wmi
The query you provided is using Use='3'
to filter out the potential for multiple results of different types. It is also only returning MaxCapacity
instead of all possible values.
Ideally, you would get the raw values this way:
unique values of string values of selects "MaxCapacity from Win32_PhysicalMemoryArray where Use='3'" of wmis
I’m actually not certain what this value represents. it doesn’t seem to match my actual free memory or total memory.
It might be the maximum amount of RAM my system can handle in KB.
From the Microsoft Reference:
Maximum memory size (in bytes) installable for this particular memory array. If the size is unknown, the property is given a value of 0 (zero).
But also:
Qualifiers: MappingStrings ("SMBIOS|Type 16|Maximum Capacity") , Units ("kilobytes")
This means this info is available in SMBIOS in addition to WMI. BigFix has a native SMBIOS inspector which is faster, more efficient, and more cross platform than using WMI. In general, any info you can get from SMBIOS you should get from there instead of from WMI whenever possible.
This means, the following would be the best possible option to get this raw data:
unique values of (it as integer) of (it as string) of values "maximum_capacity" of structures "physical_memory_array" of smbios
This would provide a more human readable parsed result:
(if (0<(it / (1024*1024*1024*1024))) then (it / (1024*1024*1024*1024)) as string & " TB" else if (0<(it / (1024*1024*1024))) then (it / (1024*1024*1024)) as string & " GB" else if (0<(it / (1024*1024))) then (it / (1024*1024)) as string & " MB" else if (0<(it / (1024))) then (it / (1024)) as string & " KB" else (it as string & " B")) of (it * 1024) of unique values of (it as integer) of (it as string) of values "maximum_capacity" of structures "physical_memory_array" of smbios
References: