Use PowerCLI to determine the ESXi host with the most available RAM

I’m working on a project right now that requires me to do a shared nothing cross vCenter vMotion of about 6K VMs. As you might know, cross vCenter vMotion requires you to specify the ESXi host and the Datastore your VM will live in within the target vCenter; no targeting a cluster of any kind. This brings up some interesting challenges when trying to automate the migration of such a large amount of VMs. One in particular, is the need to target the ESXi host that has the most free space. I am using the function below to do just this – hopefully it helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright VirtJunkie.com ยฉ 2024