Rename a Network Interface from the Command Line

While building a Hyper-V server this week, I decided to rename the network interfaces to something that would make identifying the iSCSI connections a little easier. Since the server was installed with only the core (no GUI) installation of Windows Server 2008 R2, the process had to be performed from the command line. The network interface is also commonly referred to by other names such as network adapter or network connection.

To show a list of the network interfaces, run the following command:

To rename the “Local Area Connection 5” in the image shown above to the name “iSCSI1”, use the following command:

Run the show interface command again to verify the name changed:

Now aren’t the network interface names in the above image a lot easier to deal with than the generic ones shown in the first image?

µ

About Mike Robbins

PowerShell Enthusiast | IT Pro | Winner of the Advanced Category in the 2013 PowerShell Scripting Games | Author of Chapter 6 in the PowerShell Deep Dives Book.
This entry was posted in Hyper-V Server 2008, Hyper-V Server 2008 R2, Storage Area Network, Windows Server 2008, Windows Server 2008 R2. Bookmark the permalink.

6 Responses to Rename a Network Interface from the Command Line

  1. Seth Fulton says:

    This issue also was tackled a few years back by the scripting guys: http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/11/how-can-i-rename-a-local-area-connection.aspx

    Does anyone have a PowerShell method they would like to share?

  2. aradillas says:

    How rename a network interface if the user hasn’t administrator rights?
    mmm…

  3. Cheryl says:

    Seth:
    Something like this should work:
    $AdapterToChange = Get-WmiObject win32_NetworkAdapter |where { $_.NetConnectionID -like “Local Area Conn*”}
    $AdapterToChange.netConnectionID = “clb”
    $AdapterToChange.put()

  4. Frank says:

    Works fine – thumbs up!
    You are my Hyper-V hero of the day :)

  5. Echo says:

    Any ideas on a automation script that will detect the last installed network, and modify it?

    Say.. if a loopback adapter was installed via DEVCON, the script would need to know the name of the loopback adapter given that it will be different depending on how many current connections the user already has.

  6. Pingback: Enabling Jumbo Frames for iSCSI on Server Core | Mike F Robbins

Leave a Reply