WiFi script for 10.10

lehmanp00
Contributor III

I have been using this script to add an SSID and password for years. From JAMF's resource kit:

https://jamfnation.jamfsoftware.com/viewProductFile.html?id=135&fid=570

Doesn't seem to be working in 10.10 when I use it as a pre-boot action. I get errors about "Legacy Commands"

Anyone have an updated script I can use?

12 REPLIES 12

jesseshipley
Contributor

Any reason you aren't doing this by a config profile?

lehmanp00
Contributor III

Yes, I use DeployStudio. We don't have OS X licenses with JAMF...Yet. We would really like to!

jesseshipley
Contributor

You can still create them in Configurator and install them as a part of your deploy studio process

lehmanp00
Contributor III

So would that be capturing the SSID config while you are doing it? Then having it run as a .pkg install during post-imaging?

jesseshipley
Contributor

The profile itself has the SSID and password embedded in it. You can have it imported to the system via a script. Check out this Krypted article for profile management via command line. http://krypted.com/mac-security/manage-profiles-from-the-command-line-in-os-x-10-9/

rtrouton
Release Candidate Programs Tester

I have a script that I'm using to set WiFi settings. It's available from here:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/setting_preferred_wireless...

mm2270
Legendary Contributor III

Hi, I was only able to look at the script currently on my iPhone, which is less than ideal, but I can tell you right off the bat the reason the script is failing is because the way many of JAMFs scripts were written prior to 10.10 is that how they are getting the operating system version is only pulling "10.1" instead of "10.10".
In the script it tries to compare the operating system version by seeing if it's less than 10.6. Since 10.1 is actually less than 10.6 it thinks it needs to run a legacy command which doesn't exist on Yosemite. All of JAMFs scripts are pulling the operating system this way and many of them have been failing on 10.10 because of it. I've argued that this legacy OS check should be removed from all of their scripts, since honestly who out there is managing Macs running 10.5 or 10.4 at this point?

So what you need to do is remove the if/then block that checks to see if the OS is < 10.6, and replace it with the line that uses networksetup contained in that same block.
The other option would be to change how the script is getting the OS version and also doing the version comparison, but personally I don't see the point. It's just unnecessary busy work if you ask me.

RobertHammen
Valued Contributor II

Would be nice to see someone from JAMF devote some time to either fix their broken scripts or remove them from the site entirely.

Some things (like createDP.py) are broken with JSS 9.6 and above, but are still essential/useful/required until JDS2 is out.

brock_walters
Contributor

I have updated this script to work correctly on 10.6 - 10.10 & it should be available soon for downloading. Thanks!

calumhunter
Valued Contributor

While you're there..... not hard to drop them all on your text editor and search for the same os version detection method and update them all with 10.10 savvy code, surely not a a big time issue?

mm2270
Legendary Contributor III

Thanks @brock.walters!
I agree with @calumhunter though. Updating all of JAMF's script to use the new proper OS version checking should be like a 1/2 hour task if even that long for someone. Hopefully someone at JAMF will agree and just update them. I know we as users can submit updated versions, but the fact there are still the older non functioning versions posted up there that folks are running across from internet searches really should be corrected by JAMF.

Thanks again though.

stmigarcia
New Contributor

@rtrouton I was able to run your script in 10.12.x and it worked well. My passphrase had a character that caused the scripted to fail. When I went back to the script and placed (' ') around the passphrase (minus the parentheses), the script ran without a hitch!

Thanks for the assist!