How to remove a Hyper-V virtual Ethernet switch

Solution 1:

A similar problem was resolved on Microsoft's TechNet forums:

We have a virtual switch setup in the Virtual Switch Manager and the adapter has been deleted by mistake using the "Change Adapter Settings..." of the Network And Sharing Center. Now, obviously the switch is in a failed state and we just want to remove it from the list.

Ultimately, the OP performed an in-depth search within the registry and found the virtual switch configuration stored within the following key:

HKLM\SYSTEM\CurrentControlSet\Services\VMSMP\Parameters\SwitchList

After they deleted the corresponding value within that key and rebooted, the virtual switch was gone.

As always, I would recommend that you export your current settings to a .reg file to have an appropriate backup before attempting similar changes.

(Source: Can't remove failed virtual switch from Hyper-V's Virtual Switch Manager)

Solution 2:

I didn't want to install the Azure Powershell tools so I just followed the steps in this video: https://www.youtube.com/watch?v=V5Gb342gSGg

Basically you go to Network Connections -> open properties for the virtual switch you want to delete -> click Configure -> go to the Driver tab -> Uninstall Device.

To prevent the Hyper-V service from creating a new one next time I restart my computer without disabling it altogether I changed the Startup Type of each Hyper-V service to be Manual.

Solution 3:

Even though I'm not using Docker, I wanted to figure out a solution without using regedit, so after attempting the answer from RobV8R, I found instructions on this question on MS Technet.

Get-HNSNetwork | Remove-HNSNetwork

Or, for a more filtered optoin, this is what I needed.

Get-HNSNetwork | ? Name -Like "Default Switch" | Remove-HNSNetwork

Also, I'm going to assume that you'll want to follow @mxgg250's advice, and set all hyper-v services to manual start, otherwise it's going to recreate the switch on reboot.