Command Line IP Configuration
Had a situation this week where I needed to configure IP address, IP Gateway, DNS, Subnet Mask, and DNS Suffix from the command line. Not hard once you have the commands. Putting it here as a reference for myself and others. Here are the three commands for doing this…be careful of line wrapping.
netsh interface ipv4 set address name="local area connection" source=static address=10.10.0.100 mask=255.255.0.0 gateway=10.10.0.254
netsh interface ipv4 add dnsserver name="local area connection" address=10.10.1.1 index=1
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v "SearchList" /d "domain.com" /f
You can also launch sconfig.cmd and borrow that interface, unless you’re scripting it with other activities.