OK, here's the issue...
It's relatively easy to rename a portgroup... The problem is every VM configure for the port group - doesn't get told of this change. The only way to correct this is to edit the settings of each affected VM - and tell it the new portgroup name...
Is there away of scripting this change - like a find and replace on the entry on the VMX file?
Regards
Mike
You could search for all vmx and do a sed for ethernet0.networkName = "Virtual Network" to make the change but not sure if the would change right away without the vmx being refreshed or reloaded. Let me look and see if anything via powershell can be done
Steve Beaver
VMware Communities User Moderator
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
Coming soon to a store near you!
*Virtualization is a journey, not a project.*
Well,,,
sed -e 's/ethernet0.networkName = "vlan11"/ethernet0.networkName = "vlan21"/' /vmfs/volumes/virtualmachines/ctx-1/ctx-1.vmx >$
mv -f /vmfs/volumes/virtualmachines/ctx-1/ctx-1.vmx.new /vmfs/volumes/virtualmachines/ctx-1/ctx-1.vmx
Changes the port group... but virtualcenter still shows the old reference... restarting hostd or vpxd doesn't fix this...
A vmware-cmd unregister kind of works - but leaves an "orphaned" VM in VC... which you have removed - before registering the VM... That FINALLY gets the port group updated - but of course is not in the right folder or resource pool...
I'm thinking vmware-cmd might be the way to go - of course the documentation for this is pretty poor...
Regards
Mike
I do something similiar with scripting the firewall configuration and the changes don't take place after editing on the ESX Host, so I use "vimsh" (< 3.5) or "vmware-vim-cmd" (3.5u1+) with something like
/usr/bin/vimsh -n -e "hostsvc/refresh_firewall" > /dev/null 2>&1
This will actually refresh on VC.
Now, I haven't tested with the vSwitch/Portgroups, but I think you can probably check out vimsh under hostsvc/net as it pertains to the networking portion
hostsvc/net/refresh
hostsvc/portgroup_{set,remove,add}
The "vimsh" environment allows for more flexibility under the ESX hood and I try to do as much advance features I can with "vimsh" that you can't with the standard esxcfg-* scripts. Would be interesting if the commands solve what you're looking for.
I would definitely do this with the powershell toolkit instead of the built-in command line.
get-vm |% { $_ |get-networkadapter |set-networkadapter -networkname VLAN123-10.15.25.0 -confirm:$false }
-KjB