Pcornel
Automation · Hyper-V Automation

Virtual Switches

Cheat sheet · https://pcornel.dk/topic.php?topic=5713

Back to the Topic

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.

Remember

  • External, internal or private.
  • SET teams NICs.
  • VLANs set per adapter.

First checks

  • Get-VMSwitch — switches
  • New-VMSwitch -Name <n> -NetAdapterName <nic1>,<nic2> -EnableEmbeddedTeaming $true — SET switch
  • Set-VMNetworkAdapterVlan -VMName <vm> -Access -VlanId <id> — VLAN

Verify in this order

switch definition → hosts → VM adapters

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5713

Confirmation

Confirm action

Continue?