You can export vSphere distributed switch and distributed port group configurations to a file. The file preserves valid network configurations, enabling distribution of these configurations to other deployments.
This functionality is available only with the vSphere Web Client 5.1 or later. However, you can export settings from any version of a distributed switch if you use the vSphere Web Client or later.
To export vSphere Distributed Switch configurations using the vSphere Web Client:
1: Browse to a distributed switch in the vSphere Web Client navigator and Right-click the distributed switch and click Settings > Export Configuration
2: Select the Export the distributed switch configuration or Export the distributed switch configuration and all port groups option.
3: Click Yes to save the configuration file to your local system.
Select a location your computer where you want to save the backup file and also provide a name for the backup file.
You now have a configuration file that contains all settings for the selected distributed switch and distributed port group. You can use this file to create multiple copies of this configuration on an existing deployment or overwrite the settings of existing distributed switches and port groups to conform to the selected settings.
Importing Distributed Switch configurations
Exported configuration file can be used to create a copy of the exported distributed switch or to overwrite settings on an existing distributed switch.
To create a copy of exported distributed switch, use the import option to create a distributed switch from an exported configuration file. The configuration file contains valid network configurations, enabling distribution of these configurations to other deployments.
To import a vSphere Distributed Switch Configuration, login to vCenter using the vSphere Web Client and navigate to Networking view.
1: Right-click on virual datacenter and click Distributed Switch > Import Distributed Switch.
2: Browse to the location of your saved configuration file.
Select the Preserve original distributed switch and port group identifiers option. Click Next.
3: Review the import settings before completing the import. Click Finish.
Restore a vSphere Distributed Switch Configuration
Use the restore option to reset the configuration of an existing distributed switch to the settings in the configuration file. Restoring a distributed switch changes the settings on the selected switch back to the settings saved in the configuration file.
1: Browse to a distributed switch in the vSphere Web Client navigator and right-click the distributed switch and select Settings > Restore Configuration.
2: Browse for the configuration backup file to use.
You can either choose to restore only vDS settings or portgroup as well along with vDS configuration
3: On Ready to complete page, review the summary information for the restore and hit finish to initiate restore process.
Note: Restoring a distributed switch will overwrite the current settings of the distributed switch and its port groups. It will not delete existing port groups that are not part of the configuration file.
Restore vDS using PowerCLI
vDS settings can also be restored using below one liner command
New-VDSwitch -BackupPath c:\vDS_backup.zip -Location SDDC -KeepIdentifiers:$true
Where -BackupPath is path to vDS backup file, -Location is datacenter we restore vDS to and -KeepIdentifiers:$true preserves port groups IDs
Backup vSphere vNetwork Distributed Switches using PowerCLI
Automate backing up DVS using Powercli and PowerShell
How PowerCLI can help you Backup and Restore vDS
I hope you find this post informational. Feel free to share this on social media if it is worth sharing. Be sociable 🙂