Configuring Windows networking via command-line with NETSH

Get list of interfaces and their state

netsh interface show interface

Get list of interfaces with their config

netsh interface ip show config

Set/change IP address for interface

netsh interface ip set address "{:InterfaceName:}" static {:IPAddress:} {:SubnetMask:} {:GatewayIP:} {:Metric:}

Add DNS server for interface

netsh interface ipv4 add dnsserver "{:InterfaceName:}" address={:DNSServerIP:} index={:Index:}

Remove DNS server from interface

netsh interface ipv4 delete dnsserver "{:InterfaceName:}" address={:DNSServerIP:}

Set interface to DHCP

netsh interface ip set address "{:InterfaceName:}" dhcp

Tags: #Os #Windows