Menu
InformatiWeb Pro
  • Index
  • System admin
  • Virtualization

Login

Registration Password lost ?
FR
  • Windows Server
    • WMS 2012
    • WS2012 R2
    • WS2016
  • Citrix
    • Citrix NetScaler Gateway
    • Citrix XenApp / XenDesktop
    • Citrix XenServer
  • VMware
    • VMware ESXi
    • VMware vSphere
    • VMware Workstation
  • Microsoft
    • Hyper-V
  • RAID
    • Adaptec SmartRAID
  • UPS
    • APC Back-UPS Pro
  • Firewall
    • pfSense
  • InformatiWeb Pro
  • Virtualization
  • VMware
  • Export, restore, or import vDS switch configuration on VMware vSphere 6.7

Export, restore, or import vDS switch configuration on VMware vSphere 6.7

  • VMware
  • VMware vCenter Server (VCSA), VMware vSphere
  • 22 January 2025 at 08:47 UTC
  • InformatiWeb
  • 2/2
Previous page

4. Restore the configuration of a virtual distributed switch (vDS)

To restore the configuration of a virtual distributed switch (vDS) from the existing switch, select the existing switch and click: Actions -> Settings -> Restore Configuration.

The "[vDS name] - Restore Configuration" wizard appears.
Click the button: Browse.

Select the previously exported zip file and click Open.

Choose:

  • Restore distributed switch and all port groups: to restore the configuration of your virtual distributed switch (vDS) and the port groups it contains.
    If port groups were deleted after creating this backup, they will be recreated with the configuration present in the backup.
    On the other hand, those not part of the backup will be kept. They will therefore not be deleted.
  • Restore distributed switch only: to restore only your virtual distributed switch (vDS) configuration.

In our case, we select: Restore distributed switch and all port groups.

Source : Restore a vSphere Distributed Switch Configuration - VMware Docs.

Confirm the restoration of the previously exported configuration by clicking Finish.

In Recent Tasks, you will see several tasks appear for your virtual distributed switch (vDS), as well as the port groups it contains (if applicable).

As expected, NetFlow settings were restored on our Virtual Distributed Switch (vDS).

The health check has been re-enabled.

NIOC has also been reactivated.

And limiting network traffic of our virtual machines through traffic shaping settings has also been restored.

5. Export, restore, or import a virtual distributed switch (vDS) configuration from the command line (via VMware PowerCLI)

5.1. Connect to VMware vCenter Server (VCSA) from VMware PowerCLI

If desired, you can also export the configuration of a virtual distributed switch (vDS) and its port groups (if applicable) from the command line using VMware PowerCLI.

To do this, open VMware PowerCLI and type this command if you are using a self-signed or invalid certificate (in the case of a lab, for example).
This will allow you to ignore the error that blocked access to VCSA due to the invalid or self-signed certificate.
Note that by default, VCSA is "secure" with a self-signed certificate.

Plain Text

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Next, connect to your VMware vCenter Server (VCSA) using this command:

Plain Text

Connect-VIServer vcsa.informatiweb.lan

A "Specify Credential" login window will appear.
Authenticate as "administrator@vsphere.local".

Once logged in as "administrator@vsphere.local", this will appear in the console:

Plain Text

Name                           Port  User
----                           ----  ----
vcsa.informatiweb.lan          443   VSPHERE.LOCAL\Administrator

5.2. Export virtual distributed switch (vDS) configuration from command line (via VMware PowerCLI)

View information about your virtual distributed switch (vDS) by replacing "MyDSwitch" with the name of your virtual switch.

Plain Text

Get-VDSwitch -Name "MyDSwitch"

Plain Text

Name                           NumPorts   Mtu        Version  Vendor
----                           --------   ---        -------  ------
MyDSwitch                      32         1500       6.6.0    VMware, Inc.

To export the configuration of your virtual distributed switch (vDS), along with its port groups, use the command below.

  • Get-VDSwitch -Name "MyDSwitch": allows you to target the desired virtual distributed switch (vDS).
  • Export-VDSwitch: allows you to export the configuration of the desired virtual distributed switch (vDS).
  • -Description "...": allows you to specify a backup within the backup (optional).
  • -Destination "...": allows you to specify the location or under what name the configuration will be exported.
    Note that the destination format must be ".zip".

Note: to only export the configuration of the switch and ignore that of the port groups it contains, add the "-WithoutPortGroups" parameter at the end of the command below.

Plain Text

Get-VDSwitch -Name "MyDSwitch" | Export-VDSwitch -Description "Bak config vDS MyDSwitch" -Destination "c:\vds_backup.zip"

Plain Text

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          16-08-22     21:09           9179 vds_backup.zip

In the desired location on your hard drive, you will find the "zip" file exported via VMware PowerCLI.

As before, this zip file contains a "data" folder with the configuration of your distributed virtual switch ([unique identifier].bak) and that of each port group (dvportgroup-xx.bak) that it contains.

5.3. Restore or import a virtual distributed switch (vDS) configuration from the command line (via VMware PowerCLI)

To import the previously exported configuration by creating a new virtual distributed switch (vDS), use the command below:

Plain Text

New-VDSwitch -BackupPath "c:\vds_backup.zip" -Name "Imported_VDS" -Location (Get-Datacenter "DC-Bruxelles")

Wait while the new virtual distributed switch (vDS) is created and the configuration is imported.

However, note that if you import the configuration on the same vCenter Server, an error will occur since you cannot create multiple port groups with the same names, even if they belong to different virtual switches.

Anything that does not conflict with your current configuration will still be imported.

To restore the existing virtual distributed switch (vDS) configuration (as we did previously from the GUI), simply use the command below specifying the name of the existing virtual switch and the path of the backup that had been created previously.

Note: to restore only the virtual distributed switch (vDS) configuration without changing the configuration of the port groups it contains, simply add the "-WithoutPortGroups" parameter to the end of the command below.

Plain Text

Get-VDSwitch -Name MyDSwitch | Set-VDSwitch -BackupPath "C:\vds_backup.zip"

This will be displayed in the console:

Plain Text

Restoring vSphere distributed switch configuration - Switch name: 'MyDSwitch', Switch version: 6.6.0, Number of port groups: 4, Number of resource pools: 0, Number of uplinks: 1, Notes: Bak config vDS MyDSwitch.

Name                           NumPorts   Mtu        Version  Vendor
----                           --------   ---        -------  ------
MyDSwitch                      32         1500       6.6.0    VMware, Inc.

As you can see, our distributed virtual switch configuration has been successfully restored from the backup.
Hence the reappearance of the 3 icons (mentioned previously at the start of the tutorial).

Traffic shaping settings have also been restored to our "DPortGroup_VMs" port group.

Sources :

  • VDS Export/Import with PowerCLI - VMware PowerCLI Blog
  • Set-VDSwitch Command | VMware PowerCLI Reference

Share this tutorial

Partager
Tweet

To see also

  • VMware ESXi 6.7 - Enable Jumbo frame support

    VMware 3/24/2023

    VMware ESXi 6.7 - Enable Jumbo frame support

  • VMware ESXi 7.0 / 6.7 - Install VMware PowerCli (with or without Internet)

    VMware 9/14/2022

    VMware ESXi 7.0 / 6.7 - Install VMware PowerCli (with or without Internet)

  • VMware vSphere 6.7 - Manage vCenter Server services (on Windows Server)

    VMware 3/20/2024

    VMware vSphere 6.7 - Manage vCenter Server services (on Windows Server)

  • VMware vSphere 6.7 - Slice the virtual hard disk of a VM

    VMware 6/14/2024

    VMware vSphere 6.7 - Slice the virtual hard disk of a VM

Comments

No comment

Share your opinion

Pinned content

  • Software (System admin)
  • Linux softwares
  • Our programs
  • Terms and conditions
  • Share your opinion

Contact

  • Guest book
  • Technical support
  • Contact

® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.

Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.