Free Memory on Nodes within a Cluster – 60 Second Solution

Sometimes you just want to see how much free memory is on each of your cluster nodes.

Here’s a quick powershell line to report that back:

$clustername = “YOURCLUSTERNAMEHERE”; Get-ClusterNode -Cluster $clustername | foreach-object {write-host $_.name (“{0:N2}” -f ((get-wmiobject -computername $_.name Win32_OperatingSystem).FreePhysicalMemory /1024 / 1024)) “GB Free”}

Should give something like this when you run in an elevated PS window:

Neat huh?

Power-what now?

For those of you interested in how it works…

$clustername = “…”

Sets a variable to the name of your cluster.

Get-ClusterNode -Cluster $clustername

Will list all the nodes in the cluster you just specified

| foreach-object

Will take the output from get-clusternode and do something with each node

Write-host $_.name …

Writes the name of the node…

(“{0:N2}” -f ( …

… followed by a number formatted to 2 decimal places…

… (Get-wmiobject -computername $_.name Win32_OperatinSystem).FreePhysicalMemory /1024 /1024 …

Gets the free physical memory of a given computer name in GB (normally it’s in kb: /1024 = MB. /1024 again = GB)

… “GB Free” }

Simply writes “GB Free”

Leave a Reply

Your email address will not be published. Required fields are marked *