All, Technology

Windows DNS Settings Scripting

Where would we be without “t’internet”, even more lonely, that’s where!

Thusly it is often useful to be able to manipulate your systems IP settings directly.

Below are the building blocks for batch files which you can use to, for instance, switch between multiple “IP setups” instantly (i.e. “work”, “home” & “mobile” setups, for instance).

Anyway, combine and customise collections of these lines into helpfully named batch files and you will have a quick and easy way to reconfigure your system!

Set Own IP Address (& Mask);
netsh interface ip set address name=”Local Area Connection” source=static addr=111.222.333.444 mask=255.255.255.255

Set Own IP Gateway (Primary);
netsh interface ip set address name=”Local Area Connection” gateway=555.666.777.888 gwmetric=0

Set Own DNS Server (Primary);
netsh interface ip set dns name=”Local Area Connection” source=static addr=999.111.222.333

Set Own DNS Server (Secondary);
netsh interface ip add dns name = “Local Area Connection” addr = 444.555.666.777

Set Own IP Address to DHCP (Dynamic);
netsh interface ip set address name=”Local Area Connection” dhcp

Set Own DNS Settings to DHCP (Dynamic);
netsh interface ip set dns name=”Local Area Connection” dhcp

Clear Own DNS Cache;
ipconfig /flushdns

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.