Manage Learn to apply best practices and optimize your operations.

Updated: Enabling VMotion from the CLI/Kickstart Script

Describes how to enable VMotion from the CLI/Kickstart Script.

While esxcfg-vswitch and esxcfg-vmnic can be used to create vSwitch with VMKernel port groups, what they are unable to do is set the attribute of “VMotion” on a portgroup, which enables the VMotion feature. However, fortunately a separate command-line tool called vimsh can. To use vimsh you must find out what the portgroup's “Internal ID” is. Each portgroup that gets created is given a name of portgroup 0 and portgroup1. You can find out the portgroup internal ID with the command

esxcfg-vswitch -l

You can then enable the VMotion attribute with the command:

esxcfg-vswitch -a vSwitch3
esxcfg-vswitch -A VMotion vSwitch3
esxcfg-vswitch -L vmnic3 vSwitch3
esxcfg-vmknic -a VMotion -i -n
service mgmt-vmware restart
sleep 20
vimsh -n -e “/hostsvc/vmotion/vnic_set portgroup


-n tells vimsh to use non-interactive mode which is suitable for scripting purposes. -e instructs vimsh to execute a command form the prompt. If you wish to learn more about vimsh, now has two whitepapers about the utility which has no man page and little command-line help from VMware. One is about general usage and the other is about using the tools to do advanced network configuration.

I would like to thank Jörg Lew for putting me on to this tip!

The guys at and myself were discussing the use of vimsh – I raised the issue of using vimish to advanced network configuration like load-balancing, failover orders, and so on. They/we discovered that for vimish to work affectively you need both the capabilities to restart the VMware Management Service and sleep – before executing the vimish command in a script. Thanks to the guys for figuring this one out…

This was last published in May 2007

Dig Deeper on VMware ESX and ESXi administrative tips

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.