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:
Connect-VIServer “MyvCenter” -username “username” -password “password”
new-vdswitch -backuppath “E:\VDSBackup\VDSconfig.zip” -keepIdentifiers -location “NameOfDatacenter”