I’ve designed a PowerShell script to help you with network team and virtual switch management in Hyper-V Server 2012. It will also work for Windows Server 2012.
Download the script file: SwitchesAndTeams
This will work whether or not you have a GUI version of Windows Server 2012 or if it’s Hyper-V Server 2012.
- Create and delete network teams
- Set IP information on the primary team adapter
- Create and delete virtual switches
- Create and delete virtual adapters
- Set IP information on management OS virtual adapters
- Set the VLAN ID for management OS virtual adapters
- New in 1.1: Show existing teams, switches, and virtual adapters
The script is entirely menu-driven.
- Download the ZIP file. In Windows Explorer, right-click it and go to Properties. Click the “Unblock” button. Alternately, use the Unblock-File PowerShell cmdlet.
- Extract the contents, or at least the SwitchesAndTeams.ps1 and SwitchesAndTeams.psd1 files to the system where you want to work with virtual switches and network teams. This script does not operate remotely.
- At the console of that system run PowerShell.exe. Then, in the folder that you extracted the files to, run .SwitchesAndTeams.ps1 to get started. Don’t forget that you can use [Tab] autocompletion so that you don’t have to type the entire name.
The primary purpose is to make it a bit easier to manipulate these items, especially in a non-GUI environment. Even the GUI has no method for creating or removing virtual adapters within the management operating system. The secondary purpose is to provide examples of how these items can be manipulated using PowerShell.