Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVS Server "MemUsg" is showing U instead of the % of memory used #20

Open
ryanchauvin opened this issue Jun 13, 2017 · 4 comments
Open

Comments

@ryanchauvin
Copy link

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.

@digitlman
Copy link

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 }
}

@loefflerman
Copy link

does not work for me. After applying your suggested code change the report shows "R" instead of "U" in the column "MemUSG"

@ryanchauvin
Copy link
Author

It doesn't work for me either

@amuenzberg
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants