Fix Physical Memory Size Count

Fixes #13 by using a proper CimInstance Object for returning the total physical memory size on the host
This commit is contained in:
LordHepipud 2019-05-02 16:26:33 +02:00
parent 09e406b90c
commit 4e995390a4

View file

@ -23,9 +23,8 @@ function ClassMemory
); );
# Lets load some additional memory informations, besides current performance counters # Lets load some additional memory informations, besides current performance counters
$MemoryInformations = Get-CimInstance Win32_PhysicalMemory; $ComputerInformations = Get-CimInstance Win32_ComputerSystem;
$capacity = $MemoryInformations | Measure-Object -Property capacity -Sum; $counter.Add('\Memory\Physical Memory Total Bytes', @{ 'value' = $ComputerInformations.TotalPhysicalMemory; 'sample' = @{ }; });
$counter.Add('\Memory\Physical Memory Total Bytes', @{ 'value' = $capacity.Sum; 'sample' = @{ }; });
return $counter; return $counter;
} }