Virtualization, Cloud, Infrastructure and all that stuff in-between
My ramblings on the stuff that holds it all together
POSH1Liner: Find all hosts with less RAM than you expect
December 11, 2014
Posted by on If you have a cluster where maybe there are some hosts with spared out RAM due to a fault or a non-standard amount of RAM you can quickly find them with this command
get-vmhost | where {$_.MemoryTotalGB -lt THE_AMOUNT_YOU_EXPECT}
For example; to find all hosts with less than 512GB of RAM
get-vmhost | where {$_.MemoryTotalGB -lt 512}
“-lt” is “less than” which is slightly less intuitive than the usual < <= operators you'd use in other languages – but handy reference here http://ss64.com/ps/syntax-compare.html
As I go deeper with PowerShell (POSH) I like convenient things like the $_. syntax – makes it dead simple to come up with useful one-liners like this.