From 4e995390a443dba33fc73caec7c697accf1e5fae Mon Sep 17 00:00:00 2001 From: LordHepipud Date: Thu, 2 May 2019 16:26:33 +0200 Subject: [PATCH] Fix Physical Memory Size Count Fixes #13 by using a proper CimInstance Object for returning the total physical memory size on the host --- modules/memory.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/memory.ps1 b/modules/memory.ps1 index 0f66764..7ac03b5 100644 --- a/modules/memory.ps1 +++ b/modules/memory.ps1 @@ -23,9 +23,8 @@ function ClassMemory ); # Lets load some additional memory informations, besides current performance counters - $MemoryInformations = Get-CimInstance Win32_PhysicalMemory; - $capacity = $MemoryInformations | Measure-Object -Property capacity -Sum; - $counter.Add('\Memory\Physical Memory Total Bytes', @{ 'value' = $capacity.Sum; 'sample' = @{ }; }); + $ComputerInformations = Get-CimInstance Win32_ComputerSystem; + $counter.Add('\Memory\Physical Memory Total Bytes', @{ 'value' = $ComputerInformations.TotalPhysicalMemory; 'sample' = @{ }; }); return $counter; }