MacBook Air Search Domains

Merieme
New Contributor

Hello everyone,

My company has 300 macs and I need to configure the search domains on each one by using a script. I found this one which works perfectly : networksetup -setsearchdomains Ethernet domain1 domain 2 domain 3.

But i had 2 little problems. First, how can I use this script on new macbook air who got a different name (interface) for the Ethernet ? Second, I wasn't able to install the script by using Casper Imaging ( even when I choose to install it After or At Reboot). But when I apply a policy on the Mac after imaging it , it works perfectly.

Thank you all in advance for your answers.

Merieme

2 REPLIES 2

acdesigntech
Contributor II

I believe the Macbook Air shows "Thunderbolt Ethernet" when the thunderbolt to ether adapter is plugged in. To test this, I check to see if the adapter is plugged in:

ThunderboltEth=`networksetup -listallhardwareports | grep "Thunderbolt Ethernet"`

if so, then I just use

networksetup -setsearchdomains "Thunderbolt Ethernet" domain1 domain 2 domain 3

franton
Valued Contributor III

Hi,

I wrote a script to combat this exact issue. Supply it with the adapter name (e.g. Ethernet) and it will find all "ethernet" devices and program them up with both DNS and Search Domain fields.

https://github.com/franton/Set-DNS-info