Possible to Add a 3rd Party Network Adapter via Script?

zetaomegagon
New Contributor III

Hello,

Firstly- please excuse my noobishness. I recently got CCT'd, and I'm mostly a lurker so not used to posting on forums in general.

That in mind:

Our institution has decided that, as a fallback, all administrative staff should be able to connect to our network via Ethernet. With that in mind we just bought a whole bunch of USB3 -> Ethernet adapters (we mostly run MacBook Airs).

What I'm wondering: is it possible to get the properly configured adapter settings from one laptop and add it to all administrator laptops via a script? Or something of similar effect? I want to do a touchless install/configuration.

Any suggestions are appreciated. Thanks in advance!

The adapter:
- Linksys USB3GIGv1
- Requires a *.pkg install................................................................done
- Requires usual 'Network Preferences' configuration....................TBD (what I'm asking about)

1 ACCEPTED SOLUTION

joshuasee
Contributor III

If you can run a script while the NIC to be deployed is plugged into the computer and network, you might be able to get away with with just creating a new location and auto populating it.

#!/bin/bash
/bin/echo "Refreshing network services."
/usr/sbin/networksetup -detectnewhardware
/usr/sbin/networksetup -createlocation Default populate
/usr/sbin/networksetup -switchtolocation Default
/usr/sbin/networksetup -deletelocation Automatic

# Delay and show countdown while letting network regain an IP.
/bin/echo -n "Waiting for network to reconnect...5"; 
/bin/sleep 1; 
/bin/echo -n "...4";
/bin/sleep 1; 
/bin/echo -n "...3";
/bin/sleep 1; 
/bin/echo -n "...2";
/bin/sleep 1; 
/bin/echo "...1";
/bin/sleep 1;
/bin/echo "
Available network services in order of priority:";
/usr/sbin/networksetup -listnetworkserviceorder

View solution in original post

3 REPLIES 3

joshuasee
Contributor III

If you can run a script while the NIC to be deployed is plugged into the computer and network, you might be able to get away with with just creating a new location and auto populating it.

#!/bin/bash
/bin/echo "Refreshing network services."
/usr/sbin/networksetup -detectnewhardware
/usr/sbin/networksetup -createlocation Default populate
/usr/sbin/networksetup -switchtolocation Default
/usr/sbin/networksetup -deletelocation Automatic

# Delay and show countdown while letting network regain an IP.
/bin/echo -n "Waiting for network to reconnect...5"; 
/bin/sleep 1; 
/bin/echo -n "...4";
/bin/sleep 1; 
/bin/echo -n "...3";
/bin/sleep 1; 
/bin/echo -n "...2";
/bin/sleep 1; 
/bin/echo "...1";
/bin/sleep 1;
/bin/echo "
Available network services in order of priority:";
/usr/sbin/networksetup -listnetworkserviceorder

zetaomegagon
New Contributor III

joshuasee,

I'll give it a try and get back to you!

Thanks!

EDIT:

Rockin'! It worked.

I ended-up using it with a login hook, so need for the echos (for me).

For anyone else interested, these are the steps I took:

  1. Created policy to install driver via Self Service (requires reboot)
  2. Created policy using above script which is triggered by login. Hardware is powered and plugged-in.
  3. Magic.

Thanks again, joshuasee!

bpavlov
Honored Contributor

Why would you need to create a new location? Why not just detect the new hardware?