Automation · Hyper-V Automation
Virtual Switches
Cheat sheet · https://pcornel.dk/topic.php?topic=5713
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— switchesNew-VMSwitch -Name <n> -NetAdapterName <nic1>,<nic2> -EnableEmbeddedTeaming $true— SET switchSet-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