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
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
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
Just what I was looking for. Thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.