Skip to main content
Question

Deploying 60+ rented laptops

  • January 18, 2012
  • 11 replies
  • 25 views

ImAMacGuy
Forum|alt.badge.img+23

We are rolling out 60+ rented laptops for a software update to iOS devices... each machine will have a factory default image on it from apple. My job is to tweak each system to disable AirPort / Enthernet, set an auto-login, and put a disclaimer on the system. I found in the JamfNation archives a script to disable the AP, but nothing (incl google) on how to disable the EN0.

What would be the easiest way to do that? Since it will probably be another group that touches the machines, i'd like to bundle the changes up into as few packages as possible. I have a DMG of the disclaimer that we are using for lion and the script for the airport disable... but nothing for the remaining requirements...

Any suggestions (keeping in mind my scripting knowledge is right around nil.)

11 replies

Forum|alt.badge.img+7
  • Contributor
  • January 18, 2012

/Library/Preferences/SystemConfiguration/preferences.plist

You can set en0 to be disabled here.

Use fseventer.app (free download) to see the before and after states when you toggle in system prefs


Forum|alt.badge.img+31
  • Honored Contributor
  • January 18, 2012

something like this can do the trick

networksetup -setnetworkserviceenabled Airport off

Do, note in Lion Airport is replaced with Wi-Fi so it would be like this for Lion

networksetup -setnetworkserviceenabled Wi-Fi off

As long as they don't have admin they shouldn't be able to re-enable it. You may have to use the MCX/Profile setting to require admin to change airport settings as well


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • January 18, 2012

The linked script could be edited to do what you need:

http://macmule.com/2011/09/09/how-to-turn-off-wireless-card/#more-315

It's mainly taken from the turn airport of script in the resource kit.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • January 18, 2012

Sorry hit post response mid thought... This might disable all network services.... Maybe what you want...

It's taken from the above linked script.

TEST TEST TEST

#!/bin/sh

#Loops through the list of network services
for i in $(networksetup -listallnetworkservices | tail +2 | cut -c 2-);
do
#Disables netwoprk services
/usr/sbin/networksetup -setnetworkserviceenabled "$disabledServices" off
echo "disabled $1..."
done

Forum|alt.badge.img+31
  • Honored Contributor
  • January 18, 2012

Yeah you can skip OS detection just by creating an array of enabled services.

networksetup -listallnetworkservices | grep -v "*"

Pretty much just like Ben posted above. Hope this helps!

-Tom


ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • January 23, 2012

Ben,

When I try yours it returns a bunch of

is not a recognized network service. ** Error: The parameters were not valid. disabled ... is not a recognized network service. ** Error: The parameters were not valid. disabled ... is not a recognized network service.

So I changed the link to when TLarkin put, and it lists the available connections (Ethernet, BlueTooth, Wi-Fi, etc) then bombs out with

/Users/jwojda/Desktop/disableNetwork.sh: line 5: syntax error near unexpected token `do' /Users/jwojda/Desktop/disableNetwork.sh: line 5: `do'

Forum|alt.badge.img+31
  • Honored Contributor
  • January 23, 2012

can you post the whole script, I could help you with it

-tom


ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • January 23, 2012

You guys are my hero's!

#!/bin/sh

#Loops through the list of network services
networksetup -listallnetworkservices | grep -v "*";
do
#Disables network services
/usr/sbin/networksetup -setnetworkserviceenabled "$disabledServices" off
echo "disabled $1..."
done

Forum|alt.badge.img+31
  • Honored Contributor
  • January 23, 2012

OK, so what services do you want disabled, all of them or just Airport, Wi-Fi?

So, for example if you wanted to disable all network services across the board, modify the script to this:

#!/bin/sh

#Loops through the list of network services
netService=$(networksetup -listallnetworkservices | grep -v "*")

#Disables network services

for service in ${netServices} ; do

/usr/sbin/networksetup -setnetworkserviceenabled ${service} off
echo "disabled ${service}..."
done

exit 0

ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • January 23, 2012

All is fine - the less connectivity the better - according to security. I ran the script and theres no output - and the connections remain active.

though the syntax looks correct...


Forum|alt.badge.img+31
  • Honored Contributor
  • January 23, 2012

well the command works manually with the Ethernet card, I think you may have to set the power on the AirPort/Wi-Fi with the -setairportpower setting.

I am testing this on 10.6.8 by the way