Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Virtualization » Install HyperV and Configure vSwitch on Windows Server with PowerShell
  • mbamclient
    How to deploy MBAM Client as part of a Windows Deployment Windows Server
  • Add a second domain to your domain
    How to add a new Domain Controller to an Existing Domain Windows Server
  • Reduce VMDK dile defragment and compact
    Analyse Disks with Treesize: Defragment and Shrink VMware Workstation VM Disks Virtualization
  • win10
    How to add a device to Windows Windows
  • UpdateOfficeOnlineServer 1
    Perform Office Online Server Update via Windows Updates Windows Server
  • M0365VBO
    Why should you use Veeam to protect your Microsoft 365 Data? Backup
  • feature image mongo
    How to Install MongoDB on a Linux System Linux
  • Featured image   Black screen issue
    How to Fix Black Screen Issues on Windows 11/10 Windows

Install HyperV and Configure vSwitch on Windows Server with PowerShell

Posted on 02/03/202402/03/2024 Christian By Christian No Comments on Install HyperV and Configure vSwitch on Windows Server with PowerShell
HyperV-and-vSwitch-creation

Microsoft’s hardware virtualisation product is Hyper-V. It enables the creation of a software version of a computer known as a virtual machine. Each virtual machine functions as a complete computer. In this article, we shall discuss how to Install HyperV and Configure vSwitch on Windows Server 2022 with PowerShell. Please see “vSwitches: How to delete Virtual Switches from Hyper-V“, Enable HyperV on Windows: How to install Windows 11 on HyperV, and How to run Windows 11 on HyperV.

With the whole VMware/Broadcom licensing concerns and the discontinuation of VMware vSphere Hypervisor (free edition) on the VMware website from Feb 12, 2024. You may want to see the employ HyperV in your lab or production environment.

Virtual machines provide greater flexibility, time and cost savings, and a more efficient utilisation of hardware when computing resources are required, compared to merely operating one system on physical hardware. These VMs runs in its own isolated space, which means you can run more than one virtual machine on the same hardware at the same time.

Note: Here is a guide if you would like to install HyperV on Windows Server 2019, 2022, or 2025 via the Roles and Features. The below steps are applicable to the following Windows Server 2019, 2022, or 2025 Editions.

Install HyperV via PowerShell

Fire up PowerShell as an Administrator (Elevated rights).

Luanch-PowerShell-as-an-Administrator

Use the command below to install Hyper-V with automatic restart

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
HyperV-Installation-Progress
HyperV-Installation-via-PowerShell

I have removed the “-Restart” just to be able to show you the screenshot of the process. You will be requested to restart your server now if you also did not include the switch.

Restart-Server-2

You can also accomplish this via the DISM command as shown below.

dism /Online /Enable-Feature /FeatureName:Microsoft-Hyper-V /All

Configure Hyper-V Virtual Switch

Creating the external, internal and private virtual switches is essential to establishing comprehensive networking configurations within Hyper-V. These virtual switches operate in distinct modes, each serving specific purposes.

Here is a guide on “Hyper-V Server Core Mode: How to install free Hyper-V Server on a VMware Workstation“. and how to create an Amazon Relational Database Service Instance.

Create External vSwitch

External Virtual Switch: Hyper-V virtual switch in external mode allows communications between virtual adapters connected to virtual machines and the management operating system.

It uses single or teamed physical adapters to connect to a physical switch, thereby allowing communications with other systems. To initiate this process, open Hyper-V Manager.

HyperV-Manager

Navigate to the Virtual Switch Manager

Virtual-switch

Choose the type of virtual switch, then select Create Virtual Switch

Create-external-switch

Enter a name for the virtual switch. Since this is an External vSwitch, select the network adapter (NIC) that you want to use, then select OK.

External-vSwitch-named

You will receive a warning indicating that proceeding with the change may interrupt your network connectivity. If you are comfortable with this potential disruption, please select “Yes” to continue.

Accept-changes

To do this via PowerShell, run the following command below to determine your existing network adapters by running the Get-NetAdapter cmdlet. Identify the network adapter name that you want to use for the virtual switch.

Get-NetAdapter

To create an external virtual switch, run the following commands, replacing the placeholder with your own values.

New-VMSwitch -Name <switch-name>  -NetAdapterName <netadapter-name>

Create Internal vSwitch

A Hyper-V virtual switch in internal mode allows communications only between virtual adapters connected to virtual machines and the management operating system.

From the HyperV Virtual Switch Manager, select Internally and click “Create Virtual Switch”.

Create-Internal-vSwitch

Enter the Virtual Switch name and ensure the internal network is selected and click Ok to complete the process.

Internal-vSwitch

To create an internal vSwitch with PowerShell, run the following command. Replace <switch-name> with the name of your switch and <switchtype> with the Internal

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

Create Private vSwitch

A Hyper-V virtual switch in private mode allows communications only between virtual adapters connected to virtual machines.

From the Virtual Switch Manager, select Private and click on “Create Virtual Switch”.

Create Private vSwitch

Enter the Private Virtual Switch Name and ensure the private network is selected and click ok.

Private-vSwitch

To create an Private vSwitch with PowerShell, run the following command. Replace <switch-name> with the name of your switch and <switchtype> with the Private.

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

FAQs on HyperV and vSwitch Creation

Is it possible to create a vSwitch without disrupting existing VMs?

You can create a vSwitch without disrupting existing VMs. However, if you are modifying the network configuration of existing VMs, such as connecting them to a new vSwitch, there may be a temporary disruption during the reconfiguration.

How can I troubleshoot vSwitch connectivity issues?

Common troubleshooting steps include checking the vSwitch configuration, ensuring the correct network adapter is selected, verifying VLAN settings, and inspecting the network configurations within the VMs themselves. Additionally, check for any issues with the physical network.

Can I add multiple vSwitches to a Hyper-V host?

You can add multiple vSwitches to a Hyper-V host. This allows you to segment and control network traffic between different VMs and external networks.

I hope you found this article useful on how to install HyperV and Configure vSwitch on Windows Server 2022 with PowerShell. Please feel free to leave a comment below.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Virtualization Tags:Hyper V, hyperV, HyperV VMs, Hypervisor, Microsoft Windows

Post navigation

Previous Post: How to create an Amazon Relational Database Service Instance
Next Post: How to Create a Windows Server VM on HyperV

Related Posts

  • VMware vCenter Standalone
    Fix VMware vCenter converter standalone started but not running Virtualization
  • Clone a Virtual Machine via Export and Import
    Clone a Virtual Machine via Export and Import: How to copy Virtual Hard Disk on Hyper-V Virtualization
  • images copy
    HA-Proxy Configuration File: Copy Between Nodes on Proxmox VE Virtualization
  • preometheus
    Monitoring Synology with Prometheus and Grafana Reviews
  • HyperV copy
    How to convert a VHDX file to a VHD Virtualization
  • 147913 228396 228395 rc
    Fix No bootable media found system halted: Unable to PXE boot Virtualization

More Related Articles

VMware vCenter Standalone Fix VMware vCenter converter standalone started but not running Virtualization
Clone a Virtual Machine via Export and Import Clone a Virtual Machine via Export and Import: How to copy Virtual Hard Disk on Hyper-V Virtualization
images copy HA-Proxy Configuration File: Copy Between Nodes on Proxmox VE Virtualization
preometheus Monitoring Synology with Prometheus and Grafana Reviews
HyperV copy How to convert a VHDX file to a VHD Virtualization
147913 228396 228395 rc Fix No bootable media found system halted: Unable to PXE boot Virtualization

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • mbamclient
    How to deploy MBAM Client as part of a Windows Deployment Windows Server
  • Add a second domain to your domain
    How to add a new Domain Controller to an Existing Domain Windows Server
  • Reduce VMDK dile defragment and compact
    Analyse Disks with Treesize: Defragment and Shrink VMware Workstation VM Disks Virtualization
  • win10
    How to add a device to Windows Windows
  • UpdateOfficeOnlineServer 1
    Perform Office Online Server Update via Windows Updates Windows Server
  • M0365VBO
    Why should you use Veeam to protect your Microsoft 365 Data? Backup
  • feature image mongo
    How to Install MongoDB on a Linux System Linux
  • Featured image   Black screen issue
    How to Fix Black Screen Issues on Windows 11/10 Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,839 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.