Restore your Distributed Switch config from saved zip

This code will restore your distributed switch to a new vcenter or the existing vcenter (if the vDS is fully deleted or missing.)
Doing this restore will allow all VMs to go from “invalid backing” to the real portgroup name, and all hosts will show their nics attached to the vDS.

#edit the path and filename as needed:

Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin VMware.VimAutomation.Vds

Connect-VIServer “MyvCenter” -username “username” -password “password”
new-vdswitch -backuppath “E:\VDSBackup\” -keepIdentifiers -location “NameOfDatacenter”

Vmware Link: