Skip to main content
Solved

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


Forum|alt.badge.img+6

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)

Best answer by joshuasee

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 original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+17
  • Valued Contributor
  • November 2, 2015

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

Forum|alt.badge.img+6
  • Contributor
  • November 2, 2015

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
Forum|alt.badge.img+18
  • Esteemed Contributor
  • November 2, 2015

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings