VMware Cloud Community
Pilu1978
Enthusiast
Enthusiast
Jump to solution

VM with largest memory

Hi,

I am looking for powercli script to find out the vm or list of vms which are running with largest memory on a cluster.

Please help.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try with

$clusterName = 'MyCluster'

Get-Cluster -Name $$clusterName |
Get-VM |
Sort-Object -Property MemoryGB -Descending |
Select -First 1 -Property Name,MemoryGB

This gives you the VM with the biggest amount of allocated memory, not necessarily the VM using the most active memory.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
CallistoJag
Hot Shot
Hot Shot
Jump to solution

Connect-VIServer -Server {hostname} -User {username} -Password {password}

Get-Folder 'XXXXX' | Get-VM | Sort MemoryGB -descending|
Select-Object Name,NumCpu, MemoryGB
export-Csv c:\tmp\report.csv
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try with

$clusterName = 'MyCluster'

Get-Cluster -Name $$clusterName |
Get-VM |
Sort-Object -Property MemoryGB -Descending |
Select -First 1 -Property Name,MemoryGB

This gives you the VM with the biggest amount of allocated memory, not necessarily the VM using the most active memory.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Pilu1978
Enthusiast
Enthusiast
Jump to solution

Thanks a lot LucD.

0 Kudos