Posted on 04-10-2012 01:30 PM
How can I get Lion to set the Airport SSID and password in the imaging workflow? I have used the command...
/usr/sbin/networksetup -addpreferredwirelessnetworkatindex en0 "SSID" 0 wpa2 "password"
This works great on the Macbook Air I am imaging, but I can't seem to get it in the imaging workflow. I always have to manually run this script after it reboots from being imaged.
Solved! Go to Solution.
Posted on 04-10-2012 01:39 PM
Did you set the script to run "At Reboot" in Casper Admin? it sounds like it needs to run on the Mac as a first run script after it reboots, not while in its imaging state, which would make perfect sense if that's the case.
And, Lion configuration profiles can only be set via scope, not inside an imaging workflow. They are basically MCX settings in a pretty GUI, so apply them the same way you would any MCX setting, via Smart Groups, etc.
Posted on 04-10-2012 01:34 PM
I guess other macs where it's not taking are not airs?
MacBook Airs have wireless as en0 others en1 (I think).
You'll either need to script finding the wireless device or could you use configuration profiles?
Posted on 04-10-2012 01:36 PM
en0 is the wireless for Macbook Airs. Like I mentioned, it works just fine when scripting after the computer has come back up after the initial image. I just want this to be an automated process. A configuration profile would work as well. How can I put the configuration profile as part of the imaging process?
Thanks so much
Posted on 04-10-2012 01:39 PM
Did you set the script to run "At Reboot" in Casper Admin? it sounds like it needs to run on the Mac as a first run script after it reboots, not while in its imaging state, which would make perfect sense if that's the case.
And, Lion configuration profiles can only be set via scope, not inside an imaging workflow. They are basically MCX settings in a pretty GUI, so apply them the same way you would any MCX setting, via Smart Groups, etc.
Posted on 04-10-2012 01:40 PM
You can set up a LaunchDaemon script combo to do this, if you want this applied as part of the imaging process.
I have an example of how to use this with network settings posted here:
https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/network_setup
This script doesn't set wireless settings, but it does show how you can set up the launchdaemon and script.
Posted on 04-10-2012 01:40 PM
Re: config profiles.
You'll need Casper 8, a valid APNS certificate & a cert on the JSS. (I think this is right).
Once that's all inplace, Imaged 10.7 macs can then have profiles assigned to them like scoping any other policy.
Posted on 04-10-2012 02:00 PM
You could also just setup a standalone profile created in iPCU and install it via the Profiles command. I use this for our Radius network. I add the certificates that I need as well. If you want to use it as a login window profile you'll need to add that in the xml file of the profile.
Posted on 04-10-2012 02:05 PM
I had the script set to "After" instead of "At reboot". This resolved the issue. Thanks
Posted on 04-10-2012 07:29 PM
/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | grep Device | awk '{print $2}'
This will determine whether wireless is on en0 or en1.
Posted on 04-11-2012 04:48 AM
I use the setairportnetwork.sh from the resource kit ran at reboot. Works in Lion for airs and macbooks in my testing.
Posted on 05-17-2012 08:37 AM
setairportnetwork.sh in the resource kit is not working for us.. apperently apple changed airport to en1.. I changed that in the script and it works in terminal but not when script is applied at reboot. I'll paste below.. should this work? or can someone point me to a script that will?
Thanks!
# HARDCODED VALUES SET HERE
SSID="" #The SSID of the wireless network to connect to
password="" #This only needs to be set if a password is required
# CHECK TO SEE IF A VALUE WERE PASSED IN FOR PARAMETERS $4 THROUGH $5 AND, IF SO, ASSIGN THEM
if [ "$4" != "" ] && [ "$SSID" == "" ]; then
SSID=$4
fi
if [ "$5" != "" ] && [ "$password" == "" ]; then
password=$5
fi
####################################################################################################
#
# SCRIPT CONTENTS - DO NOT MODIFY BELOW THIS LINE
#
####################################################################################################
if [ "$SSID" == "" ]; then
echo "Error: The parameter 'SSID' is blank. Please specify a SSID."
exit 1
fi
OS=/usr/bin/sw_vers -productVersion | /usr/bin/colrm 5
if [[ "$OS" < "10.6" ]]; then
echo "Setting airport SSID to $SSID..."
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z -A["$SSID"] --password="$password"
else
echo "Setting airport SSID to $SSID..."
/usr/sbin/networksetup -setairportnetwork en1 "$SSID" "$password"
Posted on 05-17-2012 08:39 AM
If that's your wireless pw you might want to remove it.
Posted on 05-17-2012 08:44 AM
Thanks.. I got that right away...
Any insight to the my question?:)
Posted on 05-17-2012 08:44 AM
delete double post
Posted on 05-17-2012 08:53 AM
No insight. But this is something I think your better setting via a configuration profile.
Posted on 05-17-2012 08:58 AM
Here's a script that may help:
# Determines which OS the script is running on
OS=`/usr/bin/sw_vers | grep ProductVersion | cut -c 17-20`
# On 10.7, the Wi-Fi interface needs to be identified
wifiDevice=`/usr/sbin/networksetup -listallhardwareports | awk '/^Hardware Port: Wi-Fi/,/^Ethernet Address/' | head -2 | tail -1 | cut -c 9-`
# Once the running OS is determined, the settings for the wireless
# network are created and set as the first preferred network listed
if [ "${OS}" = "10.7" ]; then
sudo networksetup -addpreferredwirelessnetworkatindex $wifiDevice settings go here
else
sudo networksetup -addpreferredwirelessnetworkatindex AirPort settings go here
fi
Posted on 05-17-2012 09:22 AM
Thanks to both of you... heading in the direction of configuration profile.. how often does that check it for a change? Can I force it to run?
Posted on 05-17-2012 09:38 AM
Configuration profile worked.. need more info..opened support case..thanks.
Posted on 05-21-2012 08:59 AM
New to using profiles... under Lion at any rate.
What's the workflow to get the profile on the machine then loaded at image time?
I was thinking putting the .mobileconfig file someplace (anyplace under admin?) then running a script to trigger the install command, I assume set to after will do.
this the right basic methodology?
thanks.
Posted on 05-21-2012 11:32 AM
What we are going to do is use a unique identifier in the computer name, in our case, (username_fac_laptop) or (username_stu_laptop) to create a smart group of newly imaged computers. You can have profile manager pointing at the smart group before the clients are actually in the group.. once the clients are added to the group at image time they should get the info immediately from profile manager..
we tested one and it worked.. so thats the way we are headed..
Hope that makes sense.. im really tired.. email me if you need more details.