PowerCLI Snippet- Total Memory Allocation

This PowerShell one liner looks at all the powered on Virtual Machines in a vCenter estate and returns the total memory allocated, rounded to the nearest GB.

1[System.Math]::Round(((get-vm |
2  where-object{$_.PowerState -eq "PoweredOn" }).MemoryGB |
3  Measure-Object -Sum).Sum ,0)

For example:

Example