Tuesday, December 9, 2025

Creating and Managing Virtual Switches in Hyper-V

Managing Hyper-V virtual switches is an integral part of working with virtual machines in Windows. These switches control how VMs communicate with each other, with the host system, and with external networks.

In this guide, we’ll walk through all the methods you can use to create and configure virtual switches in Hyper-V.

There are two primary ways to create a virtual switch: through the Hyper-V Manager interface or by using PowerShell. You can use any method that suits your workflow best.

1. Create a Virtual Switch Using Hyper-V Manager

To create a Virtual switch using Hyper-V Manager is the most straightforward method, especially for beginners. Follow these steps:

1. Launch Hyper-V Manager on your Windows machine.

Hyper-V Manager

 

2. In the right-side Actions panel, click Virtual Switch Manager.

Hyper-V Manager | DESKTOP-STTSON1

 

3. When the Virtual Switch Manager window opens, select New virtual network switch.

Virtual Switch Manager | DESKTOP-STTSON1

 

4. Choose the type of switch you want to create. Hyper-V offers three switch types:

  • Private Switch – Only VMs connected to this switch can communicate with each other. No communication with the host or external network.
  • Internal Switch – Allows communication between VMs and the host operating system, but not the external network.
  • External Switch – Connects VMs to the physical network. This allows internet access or communication with other devices on the network.

5. After selecting a switch type, click Create Virtual Switch.

Virtual Switch Manager | DESKTOP-STTSON1

 

6. Enter a name for your new switch.

7. If you chose an External switch, select the physical network adapter from the drop-down list.

8. You may also check the Allow management operating system to share this network adapter, depending on your needs.

Virtual Switch Manager | DESKTOP-STTSON1

 

9. VLAN ID settings can be configured here, but they should be left untouched unless you’re working with VLANs.

10. Click Apply, then OK to finish the setup.

Before creating virtual switches, make sure Hyper-V is installed and running correctly.

2. Create a Hyper-V Virtual Switch Using PowerShell

PowerShell is a great option if you want to automate switch creation or work faster through command-line operations.

Right-click the Start button and choose Windows PowerShell (Admin).

To view available network adapters, run:

> Get-NetAdapter

wp-image-33106

Based on the type of switch you want, run one of the following commands:

External Virtual Switch

> New-VMSwitch -Name "<switch name>" -NetAdapterName "<adapter name>" -AllowManagementOS $true

wp-image-33107

Internal Virtual Switch

> New-VMSwitch -Name "<switch name>" -SwitchType Internal

wp-image-33108

Private Virtual Switch

> New-VMSwitch -Name "<switch name>" -SwitchType Private

wp-image-33109

 

Replace <switch name> and <adapter name> with your preferred names.

Virtual Switch Manager | DESKTOP-STTSON1

 

Once the command executes, your virtual switch will be created instantly.

How to Remove Virtual Switch in Hyper-V?

To remove a Hyper-V Virtual switch perform the following steps:

1. Open Hyper-V Manager by pressing the Windows key, typing Hyper-V Manager, and opening it.

2. In the left panel, click on your host machine name.

3. In the right Actions panel, click Virtual Switch Manager.

4. In the Virtual Switches list, select the switch you want to remove (for example: ExternalSwitch, vEthernet, etc.).

5. Click the Remove button at the bottom.

Virtual Switch Manager | DESKTOP-STTSON1

 

6. When the confirmation prompt appears, click Yes.

7. The virtual switch will be removed successfully.

To remove a Hyper-V Virtual switch using powershell, list all Virtual switches using this command:

wp-image-33112

 

To remove a Virtual Switch use:

> Remove-VMSwitch -Name "switchname"

wp-image-33113

 

Replace “switchname” with your vSwitch name.

Conclusion

We demonstrated two most effective ways to create virtual switches in Hyper-V. Whether you prefer the graphical interface or the speed of PowerShell, setting up virtual networking in your Hyper-V environment is quick and simple. Feel free to share your experiences or questions in the comments.



from StarWind Blog https://ift.tt/D49wzKi
via IFTTT

No comments:

Post a Comment