Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Unix command in ARD to remove DNS Servers from Network prefs?

I need to know how to send a unix command to remove DNS Servers in Network preferences. I need the DNS Servers field to be blank. Can this be done?

Mac OS X (10.3.9)

Posted on Feb 23, 2006 2:57 PM

Reply
14 replies

Feb 23, 2006 3:19 PM in response to macsense

networksetup -setdnsservers <networkservice> <dns1> [dns2] [...]

Set the <networkservice> DNS servers to <dns1> [dns2] [...]. Any number of dns servers can be specified. Specify "Empty" for <dns1> to clear all DSN entries.

So if you check the Ethernet connection you'd send the command: networksetup -getdnsservers Built-in\ Ethernet

For more options, send the Unix command networksetup -help to the client computer.

Feb 23, 2006 3:19 PM in response to macsense

Send:

networksetup -setdnsservers <networkservice> <dns1> [dns2] [...]

as root. Specify "Empty" for <dns1> to clear all DNS entries.

---------

To see more commands like this, go to Terminal and enter

/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/netw orksetup -help

/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support/syst emsetup -help

or from within the Remote Desktop Admin in the Send Unix Command window type:

networksetup -help
systemsetup -help

Mar 1, 2006 10:34 AM in response to varjak paw

After the unix command to remove the DNS servers I wish to reboot the workstations. Here is what I'm using now.

networksetup -setdnsservers "Built-in Ethernet" "Empty"
sudo shutdown -r now

This appears to do the trick and restart the workstation however in ARD the task keeps showing that it is still processing long after the machine has rebooted. Is there a trick to get the unix command to quit after restarting?

Thanks again.

Mar 1, 2006 2:11 PM in response to varjak paw

That makes sense. I tried...

networksetup -setdnsservers "Built-in Ethernet" "Empty"
sleep 20
sudo shutdown -r now

which causes the system to pause 20 seconds before restarting and it still does it. Even running the sudo shutdown -r now by itself causes the problem. So even sending a restart command may not allow enough time for ARD to report back before the machine restarts. Hmmmm....

Mar 23, 2006 6:30 AM in response to macsense

Our network administrator is getting ready to change the IP address of our DNS server. This means I have over 30 Macs that will be needing changes to their DNS settings. Since each machine is setup with limited access to the system prefs, that means I have to go to each machine and log in as the admin user to make this change. In the interest of saving time, is this something I can do with Remote Desktop and how? Would I use the same commands in this post and replace dns1 with our DNS' new IP address? Will this distrupt the users access to the network when I do so?

Thanks for any help.
Beth

Unix command in ARD to remove DNS Servers from Network prefs?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.