Hi,
I am using the below script to get the VMhost name which has less CPU and Memory used. How can I get the VMHost name which has minimum 30% of free CPU and 30% free Memory of the total capacity of the VMHost.
Get-Cluster MyClust | Get-VMHost |
where{$_.PowerState -eq 'PoweredOn'} |
Sort-Object -Property CpuUsageMhz, MemoryUsageGB |
Select-Object -First 1 -ExpandProperty Name