Using PowerShell to configure the extensible switch
Let’s briefly look at two scenarios where PowerShell can be used to configurevarious features of the extensible network switch.
Scenario 1: Enabling advanced networking features
In an upgrade scenario, you want to take advantage of advanced
networking features of the extensible network switch. Namely, you want
to enable the following on all VMs on a Hyper-V host:
Here’s what a VM looks like without any of the advanced networking features enabled:
Now let’s do this on a Hyper-V host on every single VM on the Hyper-V host.
First, let’s list all the VMs by issuing the Get-VM cmdlet:
We have four VMs on this host. Let’s activate DHCP Guard, router advertisement guard, and VMQ in a single line:
Once the PowerShell prompt has returned, we can view the settings on any VM on this host:
Note: to do this in a Hyper-V cluster, simply prepend the previous statement with Get-ClusterGroup:
Scenario 2: Configure ACLs on a VM
Most organizations have a management network segment and will
typically associate a physical NIC on the management network segment.
Suppose you want to limit the network segment associated with the virtual NIC connected to the management network. Here’s how you’d create an ACL to accomplish this:
This cmdlet allows both inbound and outbound traffic to the VM named
wds02 from the 192.168.1.0/24 segment. To view the settings: