PowerCLI: How to find an ESXi host’s system memory

powerclivmware-esxi

A view of a VM host gives me the field .Config.ConsoleReservation, but ESXi doesn't have the console any more. The vSphere GUI shows total memory and system memory for ESXi hosts.

How can I get an ESXI host's system (vmkernel) memory?

Best Answer

This appears to work:

$totalmemoryB = $view.Hardware.MemorySize
$totalmemoryMB = [Math]::Round($totalmemoryKB / 1024 / 1024)
$limitmemoryMB = $view.SystemResources.Config.MemoryAllocation.Limit
$systemmemoryMB = $totalmemoryMB - $limitmemoryMB