Setting IP addressing from the command line

There are two ways of configuring IP addresses from the command line one is using netsh and the other is using PowerShell 3 and above.

First you need to find what the interfaces are:

netsh interface ipv4 show interfaces


Idx Met MTU State Name
— ———- ———- ———— —————————
1 50 4294967295 connected Loopback Pseudo-Interface 1
3 20 1500 connected Ethernet

having determined the name of the interface is Ethernet you can set the ip with the following command

netsh interface ipv4 set address name=ethernet source=static address= mask= gateway=


You can add a DNS server with

netsh interface ipv4 address dnsserver name=ethernet address= index=1

use index=2 for the secondary DNS server and so on.


Using  PowerShell


Name           InterfaceDescription                      ifIndex Status MacAddress LinkSpeed
—-               ——————–                              ——-  ——       ———-        ———
Ethernet     NVIDIA nForce Networking Controller 3 Up 00-19-21-D1-04-9C 100 Mbps



with PowerShell

Set-NetIPAddress -InterfaceIndex 3 -IPAddress -PrefixLength 24

And for DNSress –InterfaceIndex 12 –ServerAddresses (“″,””)

Set-DnsClientServerAddress –InterfaceIndex 3 –ServerAddresses (“″,””)

Another way to do this it to use sconfig if you are on a core server. Window 2008 R2 and onwards.