Cim_PhysicalMemory and Win32_ComputerSystem return different amounts of memory

I am trying to write a PowerShell script that shows the amount of memory installed on the server (physical server with 512 GB).
I tried three different methods and I have different results.

  • Win32_PhysicalMemory

     (Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum)/1GB 

    This returns 255.99 GB.

  • Win32_ComputerSystem

     $InstalledRAM = Get-WmiObject -Class Win32_ComputerSystem [Math]::Round(($InstalledRAM.TotalPhysicalMemory/1GB), 2) 

    This returns 511.88 GB.

  • Cim_PhysicalMemory

     $MaxRam = 0 $RamPool = (Get-CimInstance -Class "Cim_PhysicalMemory" | % {$_.Capacity}) foreach ($RamBank in $RamPool) { $MaxRam += $RamBank/1024/1024 } 

    This returns 255.99 GB.

Taskmanager / systeminfo show that 512 GB is installed.

When I use Win32_PhysicalMemory to print the memory installed in different memory banks, I get 8 banks of 32 GB each. But I'm sure the server contains 512 GB.

Can someone explain to me why method 1 and 3 returns 256 GB?

Update :
When I look in the BIOS, I see that 256 GB is assigned to each physical processor. My knowledge is not so advanced, but is it possible that I should first request NUMA nodes and the foreach node to get the amount of memory assigned to it? Or is this not possible with Powershell?

+5
source share
1 answer

CIM_PhysicalMemory and Win32_PhysicalMemory are the same [ 1 ].

This property inherits from CIM_PhysicalMemory.

Here the value is obtained from [ 1 ].

This value comes from the structure of the memory device in the version information of SMBIOS. For SMBIOS versions 2.1 through 2.6, the value comes from the Size member. For SMBIOS version 2.7+, the value refers to the Extended Size element.

The SMBIOS standard says: 2 ]

The Extended Size field is intended to represent memory devices larger than 32,767 MB (32 GB - 1 MB), which cannot be described using the "Size" field. This field only makes sense if the value in the Size field is 7FFFh. For compatibility with older SMBIOS parsers, smaller memory devices (32 GB - 1 MB) should be represented using their size in the Size field, with the result that the Extended Size field will be set to 0.

As you say, you have 8x64GB, but 8x32GB is displayed, I do not like this, as the NUMA problem. If it is NUMA, I would expect you to get 4x32GB. In addition, I have a server with 8x32GB and 2 sockets. Therefore, if this is a NUMA problem, I would expect to see the same problem on my inbox. However, I am displaying the quantity correctly. It looks like your BIOS uses SMBIOS standad strcuture up to 2.7.1, which is strange, although since 2011.

Try checking your SMBIOS version with

 (Get-CimInstance -ClassName Win32_BIOS) | Select-Object SMBIOS* 

For me, SMBIOSVersion returns the vendor BIOS version number instead of the standard one, but SMBIOSMajorVersion and SMBIOSMinorVersion return the correct value.

Win32_ComputerSystem requests information from the Win32 api [ 3 ].

The total size of physical memory. Keep in mind that under some circumstances this property cannot return the exact value of physical memory. For example, it is inaccurate if the BIOS uses some physical memory. For the exact value, use the Capacity property in Win32_PhysicalMemory.

0
source

Source: https://habr.com/ru/post/1271146/


All Articles