NIC Teaming – the powershell way

Whenever someone asks me to make him a new VM, I never miss an opportunity to make a joke – maybe you want a Server Core version. Some people accept the joke, but most are terrified. Then I need to relax them and tell them that this is just a joke; I know that they want the GUI.

Still, the Core version is not so scary. Neither is power shell. I will show you that in this article.

So far, I explained to you how to make a NIC team in Windows Server 2012 R2, using either the local GUI or remote access to that machine. We saw that a RSAT toolkit might be excellent solution for you. I also mentioned that this GUI frontend executes the power shell commands in the background. Also, you can execute them, too.

I will guide you through all PS commands for the NIC teaming, that you can execute on any Window Server – the GUI, Core only or even Hyper-V. Actually, the Hyper-V server is the Windows Server Core Datacenter edition with only Hyper-V role enabled on it. Oh, and it’s free, too.

 

By the power of the shell

Even if you’re not familiar with the power shell (PS) environment, you can easily learn and use it. If you look on them, you can see that all PS command are get-, set-, add-, remove-, rename-… something. Moreover, you can learn a lot about PS if you use the PS ISE (Integrated Scripting Environment) version on the Server GUI version.

I will use PS ISE only to show you all commands related to the NIC teaming feature. The NIC teaming feature is actually named Load Balancing and Fail Over or LBFO in short. As this is the network related feature, it’s eventually named NetLBFO. We will find this module in the drop-down list.

01 - ISE list

If you look on this list, you can see that there are commands for all tasks we performed using the GUI environment. Additionally, you can see in PS ISE all mandatory and optional parameters that you may specify. I would like to suggest to you to use regular PS, as PS ISE exists only on the GUI version.

For all of you, my friends, who are impatient, I uploaded the single file with all commands mentioned in this article. Moreover, this file covers additional commands that we will cover in the second part of this story.

 

Let’s begin!

We want to build the NIC team, the same as we made from the GUI environment. We can find the command for that – New-NetLbfoTeam. When we check it, we can see that we need to specify all NICs that will be part of the team. We need to use their names.

So, which are the names of NICs? And no cheating, you can use only the command line. I will use the PS commands here, but there are also the other ways.

We will use another command not enlisted here – Get-NetAdapter. It belongs to another module named NetAdapter. Remember it, as we will use it often in the today’s story.

02 - Get-NetAdapter

The first column will return the names of all NICs in the system. In case that you’re troubleshooting problems on the Hyper-V server, here is a moment to check if the NIC is recognized by server. If you can’t see it here, then the NIC itself is either defective or unsupported by OS.

Great, we have the names! Let’s begin with the creation process. As I mention, the command is New-NetLbfoTeam. We need to specify at least the name of team and the names of NICs that will belong to it.

New-NetLbfoTeam -Name LAN -TeamMembers Ethernet,"Ethernet 2"

We need to confirm this action and to wait for the command to finish.

03 - New NIC team

Don’t be upset for the down status. We have a new team and all NICs in it should be reconfigured and reconnected with the network switch. This process will take a few seconds.

We can check the status of the team with the command Get-NetLbfoTeam. The team and NICs reconfigured in a short time.

04 - Get-NetLbfoTeam

We just made the NIC team in the same way we done it from the GUI. As I’m using Windows Server with the GUI, I can compare the PS and GUI window.

05 - We made it

 

Checking our team

We’re now in the command line. We don’t have the GUI tools and we want to check our new team. We need command that will return this information for us.

We can check all members (physical NICs) of this team with the command Get-NetLbfoTeamMemeber.

06 - Get-NetLbfoTeamMember

Keep in mind that the members are the physical NICs in the system and that our team is a virtual adapter built over them. Additionally, when we activate the team, then the NICs are just the physical interfaces between our server and network switch. From the perspective of the applications and OS, the system has only this team as the NIC.

We can see this when we execute the command Get-NetLbfoTeamNic. The interface description will clearly indicate that this is the virtual adapter.

clip_image012

 

Now it’s your turn

In this article, I guide you through the basic PS commands for the NIC teaming. We made the same team as from the GUI using only PS. Even more, we can make the script and execute commands automatically.

Download this file with all commands from today’s article; then try it in your lab. You can use this file as basis for your own configuration scripts.

We can perform even more tasks with our NIC team. I will leave that part of the story for another article.

Stay tuned.

Advertisements

3 thoughts on “NIC Teaming – the powershell way

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