title: Is there any easy way to use PowerCLI to sort ESX hosts based on their overall utilization?
body: <p>I attempted to sort hosts using code that was similar to this (this may be slightly incorrect because I'm not currently at a box with PowerCLI installed):</p>
  
  <pre><code>$hosts = Get-VMHost
  $SortedHosts = $hosts | Sort-Object CPUUsageMhz,MemoryUsageGB
  </code></pre>
  
  <p>The problem with this is that it is sorting it based on CPUUsageMhz first, then sorting it by MemoryUsageGB. I want to sort it so that the host with the overall lowest usage (Memory and CPU) is at the top/front of the list, and the most utilized host is at the bottom. An issue I ran into with my current sorting method is that a host with the lowest CPUUsageMhz had the highest MemoryUsageGB.</p>