Posted on 09-19-2017 06:43 AM
We found that some of the mac users in the company are using google dns and we would like to set everyone's dns to our dns. Is there a script we can push out via jamf to set DNS on all our macs including wifi/ethernet?
Thanks
Posted on 09-19-2017 07:02 AM
Here's a script I use. I haven't done much with it lately, but I think it still gets the job done.
#!/bin/bash
NetworkServices=`networksetup -listallnetworkservices`
if [[ $NetworkServices =~ "Wi-Fi" ]];then
networksetup -setdnsservers Wi-Fi empty
echo "Reset DNS Servers for Wi-Fi"
fi
if [[ $NetworkServices =~ "Ethernet" ]];then
serviceName=`networksetup -listallnetworkservices | grep "Ethernet" -m 1`
networksetup -setdnsservers "$serviceName" empty
echo "Reset DNS Servers for $serviceName"
fi
if [[ $NetworkServices =~ "LAN" ]];then
serviceName=`networksetup -listallnetworkservices | grep "LAN" -m 1`
networksetup -setdnsservers "$serviceName" empty
echo "Reset DNS Servers for $serviceName"
fi
Posted on 01-30-2018 08:35 AM
Just what I was looking for. Thanks!