Posted on 12-29-2015 03:42 PM
We have a few hundred Macs spread out over our offices around the country/world and sometimes the search domains get edited and important information is deleted. I'd like to set up an ongoing policy so that 3 search domains are added back to each adapter. I'd like this to append and not to overwrite whatever is there, but also not to add a duplicate. We have Macbooks, Macbook Pro's and Macbook Airs.
We do use DHCP servers but the Network Admins don't push out Search Domains that way, they use AD GPO's. I don't think we can use these without third party software.
Thanks.
Posted on 12-30-2015 03:42 AM
You can use networksetup -setsearchdomains <interface> <searchdomain>
to set it.
Although it would be cleaner to check if its there and add it if needed, the -setsearchdomains option already handles this and only adds the entry if its missing.
A short for
loop would work well for this.