Automation

 View Only
  • 1.  VM with largest memory

    Posted Jul 17, 2023 12:54 PM

    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.



  • 2.  RE: VM with largest memory

    Posted Jul 17, 2023 01:04 PM
    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


  • 3.  RE: VM with largest memory
    Best Answer

    Posted Jul 17, 2023 01:15 PM

    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.



  • 4.  RE: VM with largest memory

    Posted Jul 17, 2023 01:48 PM

    Thanks a lot LucD.