How to push WIFI to a computer

emmittrbdc
New Contributor

First- I apologize but I have searched everywhere and can't find a direct answer.
I'm wanting to push our WiFi password to select computers via Casper (latest version). When my rep was here he created a WiFi Network under "configuration profiles" and when he pushed it to my computer it was instantaneous. When I add a computer it doesn't happen at all.

6 REPLIES 6

rmanly
Contributor III

If you can't get the profile problem figured out you can send this command via a Group or SMART Group.

networksetup -setairportnetwork en1 $network $password

Provided of course that Wi-Fi interface == en1

CasperSally
Valued Contributor II

Tested on mulitple models on 10.7.4 following works so you don't have to worry which interface is which. Tested as working as well on macbook 10.8 - haven't gotten to testing other models.

networksetup -setairportnetwork AirPort $network $password

chris_kemp
Contributor III

One caveat: if, for some reason, your interface is not actually named "AirPort", I believe this will fail.

IIRC, I ran into this trying to name LAN ports...please, correct me if I'm mistaken as this was some time ago - but if I'm correct then it's worth bearing in mind. :-)

Paul_Price1
New Contributor

We use configuration profiles for our WiFi configs. They work great (we are running 10.7.3 and newer OS.) Check your scope
You can force the config profile update by typing sudo jamf configurationprofile in terminal (nice for testing purposes)
Under the inventory of the computer you are trying to push the config profile too you can see if the profile was applied. Look on the left under management history.

Hope those suggestion are of some value.

jaferguson
New Contributor II

I got some help from JAMF and put together this script:

#!/bin/sh

#Make variable for Wi-Fi to use in networksetup commands

hdware=/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }'

result=/usr/sbin/networksetup -getairportnetwork $hdware | sed 's/Current Wi-Fi Network: //g'

# Place your wifi ssid in first position of Preferred Wireless Networks
networksetup -addpreferredwirelessnetworkatindex $hdware your wifi ssid 0 WPA2 wifi password

# We use WPA2 Personal but you can chose your own security in place of it above

# Power cycle Wireless Network Card
networksetup -setairportpower $hdware off
networksetup -setairportpower $hdware on

This has worked for me in OS X 10.7 and 10.8 when we had a wireless network name change this year. Had to work with networking to transition but it worked on all our wireless macs that were used during the transition period.

roadrunner2348
Contributor
I got some help from JAMF and put together this script: #!/bin/sh #Make variable for Wi-Fi to use in networksetup commands hdware=/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }' result=/usr/sbin/networksetup -getairportnetwork $hdware | sed 's/Current Wi-Fi Network: //g' # Place your wifi ssid in first position of Preferred Wireless Networks networksetup -addpreferredwirelessnetworkatindex $hdware your wifi ssid 0 WPA2 wifi password # We use WPA2 Personal but you can chose your own security in place of it above # Power cycle Wireless Network Card networksetup -setairportpower $hdware off networksetup -setairportpower $hdware on This has worked for me in OS X 10.7 and 10.8 when we had a wireless network name change this year. Had to work with networking to transition but it worked on all our wireless macs that were used during the transition period.

I'm trying to setup a nearly identical script but the problem I am having is when it gets to the networksetup -addpreferredwirelessnetworkatindex command I get a login prompt asking for credentials for the System keychain. If I run the command by itself it go through without a problem but in a script I keep getting this prompt. Anyone have any ideas as to why?

Thanks,
Justin