Home > Blogs > VMware PowerCLI Blog

Migrating VMs without VMware VMotion.

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!

5 thoughts on “Migrating VMs without VMware VMotion.

  1. Michael Verret

    Why is it, then when using the VMware cmdlets for a vmotion would there be a pause in a virtual machine? if it calls the “VMotion” process, what causes this pause? While this is an interesting feature in powershell, having the pause makes VMware (from a vmotion perspective) nothing more than hyper-v

  2. Carter Shanklin

    The interesting thing about Mike’s script is that you don’t have to buy VMotion to get functionality similar to VMotion.
    The Move-VM cmdlet will take advantage of VMotion if it’s available, and if it is the VM is moved with no down time. Since VMotion is a feature licensed through VMware Enterprise you may not have it available to you.
    Mike’s script suspends the VM before moving it. When the VM is suspended, not only is not processing anything, but it is moved very differently, using a feature that’s available even without Enterprise licensing. There is down time, which makes this way of doing it similar to quick migration.

  3. Chris Smith

    Shame that this like to mike script point to a broken url.

  4. Carter Shanklin

    I fixed the link, thanks for the heads up.

  5. Chris

    The link is broken again


Leave a Reply

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