Generate PowerShell commands to create Hyper-V external, internal, or private virtual switches, with optional VLAN tagging.
Hyper-V virtual switches come in three types. An external switch binds to a physical NIC and gives VMs direct access to the physical network. This is the most common type for production workloads. An internal switch lets VMs talk to each other and to the Hyper-V host, but does not have a physical NIC -- useful for test environments with a NAT connection. A private switch isolates VMs from everything including the host, useful for completely sandboxed labs.
VLAN tagging in Hyper-V is configured on the VM network adapter, not on the switch itself. Set-VMNetworkAdapterVlan assigns a VLAN access port to a specific VM NIC. To trunk multiple VLANs, use -Trunk mode with -AllowedVlanIdList. The management OS VLAN is set with -ManagementOS flag, which assigns the VLAN to the host-side virtual NIC connected to the switch.