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:
1 | netsh interface ipv4 show interface |
To rename the “Local Area Connection 5” in the image shown above to the name “iSCSI1”, use the following command:
1 | netsh interface set interface name = "Local Area Connection 5" newname = "iSCSI1" |
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?
µ
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?
How rename a network interface if the user hasn’t administrator rights?
mmm…
Seth:
Something like this should work:
$AdapterToChange = Get-WmiObject win32_NetworkAdapter |where { $_.NetConnectionID -like “Local Area Conn*”}
$AdapterToChange.netConnectionID = “clb”
$AdapterToChange.put()
Works fine – thumbs up!
You are my Hyper-V hero of the day 🙂
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.