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 vmreconfig.pl, which looks like it should do the job, but I haven't seen any example of how it can manage network ports.

  • 2
    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. Jun 28, 2011 at 14:05
  • @Jed - my mistake! Amended as required.
    – Coops
    Jun 28, 2011 at 14:23

2 Answers 2


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


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

Just the job!


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.

  • 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, 2011 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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