You can add and delete virtual switches by using the --add|-a and --delete|-d options.
Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of <conn_options>
.
- Add a virtual switch.
vicfg-vswitch <conn_options> --add vSwitch2
After you have added a virtual switch, you can set switch attributes. See Setting Switch Attributes with vicfg-vswitch. You can also add one or more uplink adapters. See Linking and Unlinking Uplink Adapters with vicfg-vswitch. - Delete a virtual switch.
vicfg-vswitch <conn_options> --delete vSwitch1
You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks, virtual machines, orvswifs
. Runvicfg-vswitch --list
to determine whether a virtual switch is in use.