Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone have an example of how to change a Vmware vSphere VM's network label (i.e. vlan) from a CLI in Linux?

I've come across VMware's perl SDK, but rather than learn it from scratch and trawl through the dense documentation I was hoping someone may have an example which does the job. Perl wouldn't be my first choice (which also slows me down).

Any help appreciated.

Update: I've come across, which looks like it should do the job, but I haven't seen any example of how it can manage network ports.

share|improve this question
What version of VMware? VMware is a company, not a product. "VMware Workstation" is a product, as is "VMware Player", "VMware ESX", "VMware Server", et al. Please choose an appropriate tag, such as vmware-workstation, vmware-player, vmware-vsphere, vmware-server. – Jed Daniels Jun 28 '11 at 14:05
@Jed - my mistake! Amended as required. – Coops Jun 28 '11 at 14:23
up vote 1 down vote accepted

After some serious googling, perl bashing and a little despair I hit on this forum post, and in particular of interest, this script.


./ --server --vmname development-3 \
   --vnic 1 --portgroup dvPortGroup-Inside --dvs dc1-cluster-e01-dvSwitch2

Just the job!

share|improve this answer

Well it's not the VM's 'network label' that you need to change but the appropriate vSwitch's port group - obviously this will change this name for all VMs that use that port group.

That said I've trawled through the PERL command line reference and cannot find a way to do this at all sorry, only through the GUI. That said I did find in THIS, under the 'Managed Object Type'/'Network' there's a method called 'Rename_Task' - I think that's how they do it via the GUI.

Of course be aware that doing this to a single host will break vMotion/DRS as these require the port groups to be identically named across a cluster.

share|improve this answer
I'm not needing to change the label name itself, instead I need to move the VM's NIC from one label to another (i.e. move it into a difference network). A lot of the tools I've found so far reconfigure the host machine's NICs, not the VMs. – Coops Jun 28 '11 at 14:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.