Use Netsh to Change TCP/IP Settings from the Command Prompt
Netsh is a tool that allows you to change TCP/IP settings from the command prompt. You can even make changes to remote workstations that you have access to. Once you learn the basics of scripting with netsh, it’s effortless to make changes (especially when compared to using the GUI and endless windows and dialogs). Netsh has been available in all versions of Windows since the Windows 2000 days.
The things you can do with netsh are pretty extensive, and there’s no way that I can sum them all up here in a simple post. What I will attempt to do though is make mention of a few examples of netsh’s usage, and add more examples in the future. For anything more extensive, the accompanying documentation is fairly decent and can be viewed by using the /? switch.
View TCP/IP Settings
netsh interface ip show config
Set IP Address
Set a static IP of 192.168.1.100, with a subnet of 255.255.255.0 and default gateway of 192.168.1.1.
netsh interface ip set address name="Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1
Obtain IP Address via DHCP
netsh interface ip set address "Local Area Connection" dhcp
Set DNS Server Address
netsh interface ip set dns "Local Area Connection" static 192.168.1.5
Dynamically Obtain DNS Settings
netsh interface ip set dns "Local Area Connection" dhcp