Skip to content

Instantly share code, notes, and snippets.

@0x62
Last active April 23, 2016 02:03
Show Gist options
  • Save 0x62/a3099bd046deb801955e to your computer and use it in GitHub Desktop.
Save 0x62/a3099bd046deb801955e to your computer and use it in GitHub Desktop.
AppleScript to update DNS servers
display dialog "What is your pass word?" default answer ""
set pass to text returned of result
display dialog "Primary DNS server" default answer ""
set dns1 to text returned of result
display dialog "Secondary DNS server" default answer ""
set dns2 to text returned of result
tell application "Terminal" to activate
tell application "Terminal"
do script ("echo " & pass & " | sudo -S networksetup -setdnsservers Wi-Fi " & dns1 & " " & dns2) in window 1
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment