how to remove GHOST vDSwitch from ESXi host moving between vCenters

I came across a failed migration and I had to set up a new vCenter server and connect the ESXi host to that new vcenter. The environment had 2 vDistributed switches and when I tried to add the host to the new vDSwitch it came up with the following error. (ended up simulating in my homelab first.)

Show details displays the following information

The following information shows up in the eventlog

This is because a hosts that disconnects from a vCenter will keep the ports and the current vDSwitch configuration so it will keep everything working if the vCenter server comes unavailable

In this case I imported the vDSwitches from the old vCenter to the new vCenter Appliance. So every portgroup and name are the same.

To solve this without downtime, you will need 2 uplinks on your vDSwitch each with another nic. If you do not have this then you will need to plan for some downtime in your production. Also you will need to connect with the vSphere client since the webclient shows you the new vDSwitch instead of the GHOST one.

  1. Connect to the esxi host with the vSphere client.
  2. Navigate to Configuration – Networking – vSphere Distributed Switch – manage Physical Adapters
  3. Select one of the uplinks and Remove the nic(s) from the uplink.
  4. Login to the vSphere Web Client and add the host to the vDSwitch
  5. Select the network adapter tasks. You can chose also to only manage physical adapters first.
  6. Since we removed a nic from the ghost vDSwitch you can assign the unclaimed nic to one of your uplinks on the new vDSwitch.
  7. Assign port groups and click finish

Repeat steps 1 to 3 to remove the second nic and then repeat steps 4 to 6 to add the nic again to your uplink on the new vDSwitch, but instead of chosing “add hosts” you select “Manage host Networking”

If everything goes well you see all nics green and working

Also the error should be gone on the host(s)

Now you can migrate the nic of the vm to the new vDSwitch

When you edit the vm before theses steps above, you will see an empty field in the network adapter.

When you expand the list you don’t even see the vDSwitch

(only my iSCSI switch is shown not the management switch)

After the above steps you will see the other port groups show up too from the second vDSwitch

Do this for every VM on that host or hosts.

if you rather watch the video on youtube klik here