Today I had the need to remove the VLAN ID from 60 ESXi 5.1 hosts. Instead of doing it 60 times manually through the KVM, PowerCLI was enlisted for the job. That wasn’t the hard part, the one-liner is quite simple..For those interested:
Get-VMHost | Get-VirtualPortGroup -Name "Management Network" | Set-VirtualPortGroup -Name "Management Network" -VLanID 0
As mentioned, this wasn’t the hard part. It appears that vSphere 5.1 has a (pretty cool!) new feature that checks whether a network change has an impact on the connectivity of the ESXi host (like changing the service console VLAN ID or IP address) and rolls back any configuration change if the host becomes unresponsive after the configuration change. Good for minor mistakes, but annoying if you want to break something on purpose.
After a bit of digging, it appears you can deactivate this rollback feature manually, by changing this file: C:\ProgramData\VMware\VMware VirtualCenter\vpxd.cfg
Look for these lines inside the vpxd.cfg:
<network> <rollback>true</rollback> </network>
Edit the config to turn the true into false, restart the vCenter Server service and you are free to break the service console!
Be sure to reactivate the rollback feature, as it is pretty handy.