Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Virtual Switches

Direct answer

Hyper-V virtual switch automation creates external, internal and private switches with New-VMSwitch, including Switch Embedded Teaming, and sets VLANs with Set-VMNetworkAdapterVlan.

When to use this

Use this when creating Hyper-V virtual switches by script.

First 30 seconds

1. Virtual switch automation: consistent names across hosts, SET teams, VLANs.

2. Creating external switches can interrupt host networking — use console/OOB.

3. Script per host consistently.

4. Validate.

5. Document.

Operational verification

switch definition → hosts → VM adapters

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Hyper-V PowerShell automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformHyper-V PowerShell automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when creating Hyper-V virtual switches by script.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Common mistakes Narrow the fault
  • Creating an external switch on the management NIC and losing connectivity.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • External, internal or private.
  • SET teams NICs.
  • VLANs set per adapter.
Key checks
  • Get-VMSwitch — switches
  • New-VMSwitch -Name <n> -NetAdapterName <nic1>,<nic2> -EnableEmbeddedTeaming $true — SET switch
  • Set-VMNetworkAdapterVlan -VMName <vm> -Access -VlanId <id> — VLAN
ReferenceWhy it matters1 section · depth on demand

What it is

Virtual switches connect VMs to networks: External, Internal or Private.

ReferenceImportant terms & boundaries2 sections · depth on demand

How it works

A Hyper-V virtual switch is a software Layer 2 switch in the host. External switches bind to a physical NIC (optionally shared with the host), Internal switches connect VMs and host only, Private switches connect VMs only. VLAN tagging is set per VM network adapter.

Example

New-VMSwitch -Name vSwitch-LAN -NetAdapterName 'Ethernet 2' -AllowManagementOS $false
Set-VMNetworkAdapterVlan -VMName web01 -Access -VlanId 20
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docHyper-V PowerShell automation current

Authoritative/upstream documentation reviewed for bounded claims in Hyper-V Automation > Virtual Switches. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://learn.microsoft.com/en-us/powershell/module/hyper-v/?view=windowsserver2025-ps · confidence 94%
Confirmation

Confirm action

Continue?