Here is a PowerShell .ps1 file snippet that will output the available RAM on a server.
You can name it freemem.ps1 and place in your local PowerShell scripts directory.
Thanks to the following for the script: Click Here
1 2 3 4 5 6 7 8 9 10 11 | $freemem = Get-WmiObject -Class Win32_OperatingSystem # Display free memory on PC/Server "---------FREE MEMORY CHECK----------" "" "System Name : {0}" -f $freemem.csname "Total Memory (GB) : {0}" -f ([math]::round(($freemem.TotalVisibleMemorySize / 1024 / 1024), 2)) "Free Memory (MB) : {0}" -f ([math]::round($freemem.FreePhysicalMemory / 1024, 2)) "Free Memory (GB) : {0}" -f ([math]::round(($freemem.FreePhysicalMemory / 1024 / 1024), 2)) "" "------------------------------------" |
If you need to find out what processes are using the most memory, you can run the following PowerShell cmdlet to do so:
1 | get-wmiobject WIN32_PROCESS | Sort-Object -Property ws -Descending|select -first 15 | Select processname, @{Name="MemUsage(MB)";Expression={[math]::round($_.ws / 1mb)}},@{Name="ProcessID";Expression={[String]$_.ProcessID}},@{Name="UserID";Expression={$_.getowner().user}} | ft -a -wr |
Happy Troubleshooting!