Thursday, September 1, 2011

Change IP Address Using Netsh.exe Command

Netsh command
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2


to change the ipv4 address, subnet mask and getway
netsh int ipv4 set address "Local Area Connection" static 192.168.0.2 255.255.255.0 192.168.0.254 1

to change DNS
netsh int ip set dns "
Local Area Connection" static 192.168.0.254 primary


The "Local Area Connection" is your Adapter name, It could also be "local area connection 2" or "wireless network connection"...




Syntax
netsh int ipv4 set address [name=]InterfaceName [source=]{dhcp | static [addr=]IPAddress[mask=]SubnetMask [gateway=]{none | DefaultGateway [[gwmetric=]GatewayMetric]}}
 

MSDN Document