We are currently working on some Cisco ACI Integration and wanted to add a large VLAN Pool to a UCS Configuration.
Since currently Cisco UCS does not allow selecting multiple VLAN’s easily when adding to a VLAN Group or vNIC Template, we now have a pretty decent script that will do it for you.
The script can be found here.
1# PowerCLI Script for adding VLAN to VLAN Group and vNIC Template 2# @davidstamen 3# http://davidstamen.com 4 5#Define Variables 6$cred = Get-Credential 7$ucs = "ucs01" 8$startvlan = "100" 9$endvlan = "150"10$vnictemplate = "vnic-template"11$vlangroup = "vlan-group"1213#Connect to UCS14Connect-UCS $ucs -credential $cred1516#Assumes VLAN Name is the VLANID. Adds VLAN from start to end to vlan group17for($i=$startvlan;$i -le $endvlan;$i++){Get-UcsFabricNetGroup -Name $vlangroup |Add-UcsFabricPooledVlan -Name "$i"}1819#Assumes VLAN Name is the VLANID. Adds VLAN from start to end to vnic template20for($i=$startvlan;$i -le $endvlan;$i++){Get-UcsVnicTemplate -Name $vnictemplate | Add-UcsVnicInterface -ModifyPresent -DefaultNet false -Name "$i"}21Disconnect-UCSYou now are done! In my case I had to add 500 VLAN’s, so this script saved me quite a bit of time.
