Server 2012 NIC Teaming HP Virtual Connect NICs with Powershell

Update April 2013, if you are using VMM setup your networks in VMM and allow VMM to the teaming.

This blog post is a follow up to my previous post about identifying and naming NICs on HP BL460c Servers with Virtual Connect Flex 10 to build my HyperV Server. I have modified that script a little to keep more of the configuration items at the top of the script and I have added Nic teaming to the script. Once the OS is installed (the script could be integrated into a MDT/OSD task sequence) you can run this script and then you are ready to assign IP addresses to the Teams and adjust any advance NIC settings.

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

#Name Each NIC

$NIC1 = "HyperV_Mgmt_Bay_1"

$NIC2 = "HyperV_Mgmt_Bay_2"

$NIC3 = "VM_Networks_Bay_1"

$NIC4 = "VM_Networks_Bay_2"

$NIC5 = "Live_Migration_Bay_1"

$NIC6 = "Live_Migration_Bay_2"

$NIC7 = "iSCSI_Bay_1"

$NIC8 = "iSCSI_Bay_2"


#name your Teams

$Team1_Name = "HyperV Management"

$Team2_Name = "VM Networks"

$Team3_Name = "Live Migration"


#Get all of the Physical NICs Hardware Info

# the function value ties back to the order of the port number in Virtual Connect

$NICS = Get-NetAdapterHardwareInfo

foreach($nic in $NICS)

{

#Get the function number for each nic as we loop through them

$NicID = $nic.Function

Switch ($NicID)

    {

        #Name Each NIC so you can easily identify what network each is plugged into.


        0{ Rename-NetAdapter -Name $nic.Name $NIC1 }

        1{ Rename-NetAdapter -Name $nic.Name $NIC2 }

        2{ Rename-NetAdapter -Name $nic.Name $NIC3 }

        3{ Rename-NetAdapter -Name $nic.Name $NIC4 }

        4{ Rename-NetAdapter -Name $nic.Name $NIC5 }

        5{ Rename-NetAdapter -Name $nic.Name $NIC6 }

        6{ Rename-NetAdapter -Name $nic.Name $NIC7 }

        7{ Rename-NetAdapter -Name $nic.Name $NIC8 }

    }

}


#Create Active/Active Teams

New-NetLbfoTeam $Team1_Name.ToString() $NIC1,$NIC2 -Confirm:$False

New-NetLbfoTeam $Team2_Name.ToString() $NIC3,$NIC4 -Confirm:$false

New-NetLbfoTeam $Team3_Name.ToString() $NIC5,$NIC6 -Confirm:$False

Remember don’t team your iSCSI NICs, you want to setup MPIO for your iSCSI connections.

Advertisements
This entry was posted in HP, Powershell, Server 2012 and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s