Commands for adding / removing IP addresses to / from NIC Windows 200x server?

How can I add / remove an IP address to / from a NIC interface using command line?
EIWAsked:
Who is Participating?
 
Rob WilliamsConnect With a Mentor Commented:
Careful doing so if your server is a DNS server:

To add you can use from a command line or use a batch file as per below to completly configure a NIC;

***************************************************
rem Reset network Settings for static IP
netsh interface ip set address name = "Local Area Connection" source = static addr = 10.0.0.99 mask = 255.255.255.0
netsh interface ip set address name = "Local Area Connection" gateway = 10.0.0.254 gwmetric = 1
netsh interface ip set dns name = "Local Area Connection" source = static addr = 4.2.2.2
netsh interface ip add dns name = "Local Area Connection" addr = 4.2.2.3
netsh interface ip show config
pause
 
*************************************************
 
rem Reset network settings for DHCP
netsh interface ip set address name = "Local Area Connection" source = dhcp
netsh interface ip set dns name = "Local Area Connection" source = dhcp
netsh interface ip set wins name = "Local Area Connection" source = dhcp
netsh interface ip show config
pause
0
 
GovvyCommented:
netsh interface ipv4
0
 
Gary ColtharpSr. Systems EngineerCommented:
netsh interface ip add address name="Interface Name" addr=x.x.x.x mask=x.x.x.x

to remove them, just replace add with delete
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.