PowerShell: Connect Virtual Machines to a New Switch

I have decided to expand on this post a little: https://www.remilner.co.uk/2017/02/22/powershell-list-all-hyper-v-virtual-machines-along-with-the-connected-switch/, which explains how to list all Hyper-V Virtual Machines along with the connected Virtual Switch.  I ran into an issue today, where one of the Virtual Interfaces on my Cisco UCS had an issue and therefore required to flip all my Virtual Machines onto a secondary Virtual NIC in order to restore service.

So we can still use this command:

Which gets a list of all VM’s connected to VM-SWITCH-B, which was the faulty VM Switch and needed to switch over to VM-SWITCH-A.  Appending the above command to the following will meet this requirement easily:

This command will need to be run against all the nodes in the Cluster (if you have one) as it is a Hyper-V command, not a Failover Cluster command.