citrix-pvs-healthcheck
citrix-pvs-healthcheck copied to clipboard
PVS Server "MemUsg" is showing U instead of the % of memory used
This started happening on the change on 2017-05-22 (proposed fix for Issue #16). I am currently using PowerShell v5 when I experience the U issue showing instead of the % of memory used.
I put the old code back and it works now.
Function CheckMemoryUsage() { param ($hostname) Try { $SystemInfo = (Get-WmiObject -computername $hostname -Class Win32_OperatingSystem -ErrorAction Stop | Select-Object TotalVisibleMemorySize, FreePhysicalMemory) $TotalRAM = $SystemInfo.TotalVisibleMemorySize/1MB $FreeRAM = $SystemInfo.FreePhysicalMemory/1MB $UsedRAM = $TotalRAM - $FreeRAM $RAMPercentUsed = ($UsedRAM / $TotalRAM) * 100 $RAMPercentUsed = "{0:N2}" -f $RAMPercentUsed return $RAMPercentUsed } Catch { "Error returned while checking the Memory usage. Perfmon Counters may be fault" | LogMe -error; return 101 } }
does not work for me. After applying your suggested code change the report shows "R" instead of "U" in the column "MemUSG"
It doesn't work for me either
changes lines 424-428 once using the following example: if( $UsedMemory -lt 0.75) { "Memory usage is normal [ {0:p2} ]" -f $UsedMemory | LogMe -display; $PVStests.MemUsg = "SUCCESS", ("{0:p2}" -f $UsedMemory)} then it should also work with Powershell 5.1. HTH Andreas