Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

batch file to change the network adapter name

Posted on 2012-09-21
8
Medium Priority
?
2,974 Views
Last Modified: 2013-05-10
Hello,

I am looking for a way to change the network adapter name useing a batch or script...

I have been trying to use the netsh command but I keep getting errors and the name is not being changed.

Command I am useing:
netsh interface set interface name="Local Area Connection" newname="Management"

Error when using commnad:
An interface with this name is not registered with the router.

any tips, ideas, changes?

thanks for the help, this problem is causing me a lot of wasted time.
0
Comment
Question by:leebaskin
6 Comments
 
LVL 14

Expert Comment

by:Rob Miners
ID: 38423831
Your command should work but if you run it again it will throw up that error

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>netsh interface set interface name="Local Area Connection" newname="Management"


C:\Windows\system32>
C:\Windows\system32>netsh interface set interface name="Local Area Connection" newname="Management"
An interface with this name is not registered with the router.


C:\Windows\system32>

Check your card to see if the name has been changed

Click Start and in the Search box type ncpa.cpl and press the Enter key.

It also responds with this error message when you try and run the command with UAC enabled.

Open Command Prompt with Run as Administrator
answer Yes to the UAC prompt
In the command window that opens, run the command

Or create your batch file and right click and then select  Run as Administrator

eXample

@echo off
netsh interface set interface name="Local Area Connection" newname="Management"
0
 
LVL 4

Expert Comment

by:Vishalnarse
ID: 38424608
Hi,


Please follow the below steps

1. (netsh interface ip set address name="Local Area Connection" source=dhcp
 netsh interface ip set dns name="Local Area Connection" dhcp )

2. (@echo off
netsh interface ip set address "Wireless Network Connection" dhcp
pause)

3. (@echo off
netsh interface ip set address name="<interface name>" static <ip addresss> <subnet mask> <default gateway> 1
netsh interface ip set dns "<interface name>" static <DNS server ip>
pause)
0
 
LVL 1

Author Comment

by:leebaskin
ID: 38429364
Awesome! Thanks for explaining the "An interface with this name is not registered with the router"

I have one other issue that I forgot to add in my description..  

I will not know what the original name of the NIC will be, the end result must be that they get changed to the correct name, but I don’t know what name will be used..  (Hope that makes since)

Is there a wildcard that I can use with this command?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 14

Assisted Solution

by:Rob Miners
Rob Miners earned 1000 total points
ID: 38430557
Here is a vbscript that could be modified to suit, you will only need the first section.

http://social.technet.microsoft.com/Forums/en/ITCG/thread/2004ec74-22b6-440d-81bd-352b9e748322
0
 
LVL 72

Accepted Solution

by:
Qlemo earned 1000 total points
ID: 38469769
There is no wildcard. You will have to combine batch commands to get the name, and you might have to restrict the list of adapters found, which is difficult if they have nothing in common ...
@echo off
for/F "tokens=3*" %%I in ('netsh interface show interface ^| find "Enabled" ^| find "Connected"') do ^
netsh interface set interface name = "%%J" newname = "Management"

Open in new window

0
 
LVL 1

Author Comment

by:leebaskin
ID: 39074903
sorry for the delay, I moved on to another job and nolonger need help on this. but I do think this answer helped out.

thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question