Migrate Port Groups from Standard Switch to Distributed Switch

In our current environment we use to create port groups on vSphere Standard Switches. It was fine until the environment was small.
Once it reached 5 Hosts and about 25 odd Port Group we started observing issues of inconsistency and issues being observed in terms of naming conventions, VLAN id not entered properly , port groups not created on all hosts and so on
We decided to migrate the Virtual Machine Port Groups to Distributed Switches. There might be multiple ways of doing it however following we felt is the best way forward
  • Get the current Port Groups of the vSphere standard switches and export CSV using following command

Get-VirtualPortGroup -VirtualSwitch vSwitch0 | Select Name,VLanID > C:\\vSSPortGroups.csv

  • Create Distributed Switch using WebClient 
  • Work with Network Team to ensure VLANs are passed on the uplinks of the Distributed Switch. In our case we had trunk all so we were covered
  • Create Port Groups in Distributed Switch using following command. We preferred to do it manually by repeating the command individually for all Port Groups. We could automate using CSV if required  

Get-VDSwitch -Name \”DVSwitch Name\” | New-VDPortgroup -Name \”DVSwitch Port Group name \” -NumPorts 8 -VLanId xxx

  • Migrate Virtual Machine Networking to the vSphere Distributed Switch using following process. We preferred to do it manually for each port group so that we could validate and ensure we are not losing connectivity. I know we can expedite but it depends on lot of things ( Non-Technical obviously J )

http://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.networking.doc/GUID-0E91679E-A896-45B9-A489-5325BE1E86BB.html

  • Once the migration is completed , Remove the Port Groups on vSphere Standard Switches using following command

Get-VMHost | Get-VirtualSwitch -Name vSwitch0 | Get-VirtualPortGroup -Name \”vSS Port Group Name \” | Remove-VirtualPortGroup -confirm:$false

Please feel free to add in your comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: