DISCLAIMER: USE COMMON SENSE! Don't go crazy and use this on a production environment without testing it first.
I've attached 2 scripts, the first being an information gathering script which saves networking config data about your hosts to a csv file.
The second intelligently migrates everything on a VDS to a VSS or VSS's depending on your VDS's Uplink configuration:
1. physical adapters
2. vmkernel adapters
3. VM's
This will migrate an environment that uses a single vDS with up to 8 uplinks where only 3 or fewer uplinks are assigned to a particular portgroup or multiple portgroups at a time. It will also take into consideration hosts that have different vmnics assigned to different uplinks.
Example environment where each host has 6 uplinks grouped by 2's:
Portgroups | Active Uplink | vDS Name |
---|
Vlan1000, Vlan1100, Vlan1200 | {Uplink 1, Uplink 2} | dvSwitch1 |
| {Uplink 3, Uplink 6} | dvSwitch1 |
| {Uplink 4, Uplink 5} | dvSwitch1 |
Hostname | Physical Adapter | Uplink assignment | dvswitch |
---|
vmhost01.local.org | vmnic0 | Uplink 1 | dvSwitch1 |
vmhost01.local.org | vmnic1 | Uplink 2 | dvSwitch1 |
vmhost01.local.org | vmnic2 | Uplink 3 | dvSwitch1 |
vmhost01.local.org | vmnic3 | Uplink 4 | dvSwitch1 |
vmhost01.local.org | vmnic4 | Uplink 5 | dvSwitch1 |
vmhost01.local.org | vmnic5 | Uplink 6 | dvSwitch1 |
vmhost02.local.org | vmnic2 | Uplink 1 | dvSwitch1 |
vmhost02.local.org | vmnic4 | Uplink 2 | dvSwitch1 |
vmhost02.local.org | vmnic3 | Uplink 3 | dvSwitch1 |
vmhost02.local.org | vmnic1 | Uplink 4 | dvSwitch1 |
vmhost02.local.org | vmnic5 | Uplink 5 | dvSwitch1 |
vmhost02.local.org | vmnic0 | Uplink 6 | dvSwitch1 |
Take note of the fact that different vmnics on vmhost02 are assigned to different uplinks than vmhost01, meaning the nics on each host are physically wired differently from one another.
Caveats:
1. If you the portgroup(s) that your vmkernels belong to have names that are similar to other portgroup(s) that aren't VMKernel portgroups, the script will detect it and try to move a vmkernel that doesn't actually exist, causing the Add-VirtualSwitchPhysicalNetworkAdapter cmdlet to fail to move the vmnic to the vSS its currently working on.
2. If you have 1 uplink assigned to vmotion1 and another uplink assigned to vmotion2, and only 2 physical NICs total on each host, it will try to create 3 standard switches even though there aren't enough nics to do that.
Otherwise, this script is fairly intelligent enough to account for most configurations under 8 physical nics, so enjoy!