Using PowerShell to Configure Virtual Machines on Multiple Computers at Once

One of the handy things with Hyper-V PowerShell interfaces is that the majority of them can be used to target multiple computers at once.  Recently I needed to set all of my virtual machines to use a new VLAN.  I was able to do this with a single PowerShell command:

get-vm -computername benarm-alpha, benarm-beta, benarm-delta, benarm-gamma | Set-VMNetworkAdapterVlan -access -vlanid 99 –passthru

This command gets all the virtual machines from four computers (benarm-alpha, benarm-beta, benarm-delta and benarm-gamma) and sets the VLAN on all of them to 99.  Handy.