posted

13 Comments

In his blog, Mike DiPetrillo shows us another example of both the power of the VMware API and the ease of use we get with the VI Toolkit for Windows. His script will move a VM from one ESX host to another, without making use of VMware VMotion. The drawback is that the VM becomes unresponsive for a period of time (usually a few seconds). This is roughly functionally equivalent to Microsoft’s Quick Migration feature, except that this was done in 130 lines of script.

I’ve traded a few emails with Mike on the subject so I can add one thing that Mike doesn’t mention in his blog. Mike has quite a lot of industry experience and has done a lot of custom development like this  before. However, until recently Mike had never seen the PowerShell or the VI Toolkit at all, yet he still was able to put this script together in the span of roughly a weekend. So I’m not trying to imply that Mike’s not a smart guy but there’s no question in my mind that the simplicity of the VI Toolkit made it possible for this really interesting script to get developed in record time.

Mike’s script asks you to log into VirtualCenter, then prompts for a source and destination host, as well as a VM to move. After a few sanity checks the VM is suspended, moved and un-suspended. That’s all there is to it. You can do this process manually through the VI Client or automatically with Mike’s script. With a couple of tweaks to Mike’s script, you wouldn’t even need VirtualCenter to make all of this happen.

Great work, Mike!