Hi
Does anyone has a script that gives the host name with most CPU and memory resources available in the cluster?
Regards
Vickie
Hello, VicMware-
You can get the host with the most free CPU resources, or with the most free memory, using the following:
## get the host with the most free CPU cycles
Get-Cluster myCluster0 | Get-VMHost | Select-Object Name,
@{n="CpuMhzFree"; e={$_.CpuTotalMhz - $_.CpuUsageMhz}} | Sort-Object -Property CpuMhzFree -Descending | Select -First 1
## get the host with the most free memory
Get-Cluster myCluster0 | Get-VMHost | Select-Object Name,
@{n="MemGBFree"; e={$_.MemoryTotalGB - $_.MemoryUsageGB}} | Sort-Object -Property MemGBFree -Descending | Select -First 1
The first would output something like:
Name CpuMhzFree
---- ----------
myVMHost0 25384
And the latter would output:
Name MemGBFree
---- ---------
myVMHost4 122.323
...where each of those hosts are the ones in the cluster with the most free CPU/memory, respectively. That get the things for which you are looking?
Hello, VicMware-
You can get the host with the most free CPU resources, or with the most free memory, using the following:
## get the host with the most free CPU cycles
Get-Cluster myCluster0 | Get-VMHost | Select-Object Name,
@{n="CpuMhzFree"; e={$_.CpuTotalMhz - $_.CpuUsageMhz}} | Sort-Object -Property CpuMhzFree -Descending | Select -First 1
## get the host with the most free memory
Get-Cluster myCluster0 | Get-VMHost | Select-Object Name,
@{n="MemGBFree"; e={$_.MemoryTotalGB - $_.MemoryUsageGB}} | Sort-Object -Property MemGBFree -Descending | Select -First 1
The first would output something like:
Name CpuMhzFree
---- ----------
myVMHost0 25384
And the latter would output:
Name MemGBFree
---- ---------
myVMHost4 122.323
...where each of those hosts are the ones in the cluster with the most free CPU/memory, respectively. That get the things for which you are looking?
