How to backup and restore vSphere Distributed Switch - logo

In one of the previous posts How to backup NSX? I showed you how the process of NSX backup. As a best practice, I suggested aligning NSX backup with vSphere Distributed Switch backup. Today I will show you how to backup and restore vSphere Distributed Switch.

vSphere Distributed Switch backup using vSphere Web Client

  1. Click Networking and click Actions from the main vSphere Web Client GUI.
    Backup vSphere Distributed Switch - 1a
  2. From the Actions menu click Settings and Export Configuration. Choose Distributed switch and all port groups. This allows us to have all settings exported and have full backup of vDS.
    Backup vSphere Distributed Switch - 2
  3. The final step is to save exported backup on the local disk.
    Backup vSphere Distributed Switch - 3
  4. Give the file meaningful name like
    Backup vSphere Distributed Switch - 4

vSphere Distributed Switch backup using PowerCLI

Once we saved the backup using vSphere Web Client we can do the same with PowerCLI. Why would you do it from PowerCLI? The answer is automation. Backup using PowerCLI means you can schedule it as scheduled task and run it periodically.

Use the following one-liner to export all vDS from vCenter Server.

Where vDS is the name of the switch and is the backup filename.

Of course, there are other (better or more complicated/sophisticated) ways to do it. Please check below blog articles for other ways to backup vDS using PowerCLI:

vSphere Distributed Switch restore using vSphere Web Client

On the vDS where will we try restore I created two PortGroups. I will delete the whole vDS from Web Client and then we will restore it from the backup.

  1. As you see my inventory has only one vDS.
    Backup vSphere Distributed Switch - 5
  2. Navigate to vCenter Server level and click Actions Distributed Switch / Import Distributed Switch.
    Backup vSphere Distributed Switch - 6
  3. What we have to do is to point to backup file previously created. I selected Preserve original distributed switch and port group identifiers. It is done to force vCenter Server to assign the same value as the Managed Object ID to the key property during port group creation. Some applications might rely on port group identifier.
    Backup vSphere Distributed Switch - 7
  4. On the Ready to complete section we have a short summary of vDS, its uplinks and port groups. Hit Finish to finalize Distributed Switch import/restore.
    Backup vSphere Distributed Switch - 8
  5. The Distributed Switch is successfully restored from the backup.
    Backup vSphere Distributed Switch - 10

vSphere Distributed Switch restore using PowerCLI

Restore is nearly as easy as backup using PowerCLI. Simply execute one-liner listed below.

Where -BackupPath is path to vDS backup file, -Location is datacenter we restore vDS to and -KeepIdentifiers:$true preserves port groups IDs.


I hope you enjoyed this article about how to backup and restore vSphere Distributed Switch.

How to backup and restore vSphere Distributed Switch
Rate this post
Wojciech Marusiak
Social Media

Wojciech Marusiak

Solutions Architect at Alibaba Cloud
I am innovative and experienced VMware and Windows Server Engineer with over 10 years in the IT industry specializing in VMware virtualization and Microsoft Server environment.

My experience and skills have been proven by leading vendor certifications like VMware Certified Implementation Expert 6 – Data Center Virtualization, VMware Certified Advanced Professional 6 – Data Center Virtualization Design, VMware Certified Professional 6 - Data Center Virtualization, VMware Certified Professional 6 - Network Virtualization, AWS Certified Solutions Architect - Associate, ITIL V3, VMware vExpert 2014 - 2017 and VMware vExpert NSX 2017 Award.

My blog - was voted #43 in Top vBlog 2017 contest!
Wojciech Marusiak
Social Media

Latest posts by Wojciech Marusiak (see all)