Unable to create a virtual switch

ack 0 Reputation points
2023-03-02T00:27:17.5066667+00:00

I was trying to create a virtual switch in powershell so that i could port forward on one of my vms in Hyper-V I have also tried using the Hyper-V virtual switch manager to create the external switch but that also returned errors like 'Ethernet port _ bind failed: Element not found. (0x80070490)'. I have tried uninstalling wireshark and reated apps, and running netcfg -d, but those have not fixed the issue Powershell:

PS C:\WINDOWS\system32> New-VMSwitch -Name "NAT" -NetAdapterName Wi-Fi -AllowManagementOS:$true
New-VMSwitch : Adding ports to the switch 'NAT' failed.
The operation failed because the object was not found.
At line:1 char:1
+ New-VMSwitch -Name "NAT" -NetAdapterName Wi-Fi -AllowManagementOS:$tr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [New-VMSwitch], VirtualizationException
    + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.NewVMSwitch

After running a second time:

PS C:\WINDOWS\system32>  New-VMSwitch -Name "NAT" -NetAdapterName Wi-Fi -AllowManagementOS:$true
New-VMSwitch : Failed while adding virtual Ethernet switch connections.
Ethernet port '{76E086C0-8B1A-4EB7-9CCE-D79F1C6B90CF}' bind failed: Cannot create a file when that file already exists. (0x800700B7).
At line:1 char:2
+  New-VMSwitch -Name "NAT" -NetAdapterName Wi-Fi -AllowManagementOS:$t ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-VMSwitch], VirtualizationException
    + FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.NewVMSwitch
Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 45,126 Reputation points
    2023-03-03T11:07:59.4366667+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    You may able to fix this by clicking the Download link below. Choose Run or Open in the File Download dialog box, and then follow the instructions in the Simple repair procedure.

    For more information, you can also check this thread and article:

    https://learn.microsoft.com/en-us/answers/questions/746205/hyper-v-not-able-to-add-new-virtual-switch

    https://learn.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines?tabs=hyper-v-manager

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.


  2. Anonymous
    2023-03-12T19:31:13.0166667+00:00

    Do not create a bridge. You could manually delete a network bridge from Device Manager, then select the bridge entry under the Network Adapters section and click Uninstall.

    Then create an external vSwitch. When you create a new external vSwitch the internet protocols are removed from the adapter and the Hyper-V Extensible Switch protocol is added turning that physical port into a multi-port virtual switch. Connect your VMs to this vSwitch and use each VM's vEthernet to configure the addressing in the exact same manner as if it were a physical NIC
    https://blogs.technet.microsoft.com/jhoward/2008/06/17/hyper-v-what-are-the-uses-for-different-types-of-virtual-networks/

    -

    --please don't forget to upvote and Accept as answer if the reply is helpful--


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.