Posted on 07-29-2013 09:06 AM
https://github.com/nmcspadden/JSSUpdater
I've written a Python script that can take a CSV file with usernames / real names matched to serial numbers and import that into the JSS to update mobile devices that have been enrolled but not assigned a username.
This may be a bit specific to my environment, but there's the context. We recently purchased 500 iPads for our new 1:1 program. As we are in the process of migrating to a new inventory system that is not quite ready, the simplest thing to do was to get all the serial numbers into a spreadsheet, just to have the data on hand. We then proceeded to enroll all the iPads into the JSS through using Configurator to load the profile.
Now we have 500 iPads that are going to be assigned to individual students. There's no simple way to import user data into the JSS, so it's easier for us to pull up the class lists from the student information system and just copy and paste names into a spreadsheet. My 500 iPad spreadsheet now contains Serial - WiFi Addr - First - Last Name - Grade.
Importing this info into the JSS isn't really possible with the GUI, but it is possible using the JSS's REST API. I created an account that has API read and write privileges and used JAMF's sample script to get the proper curl commands.
This Python script reads the spreadsheet (in CSV form), parses it into a list of serial numbers, and then matches those serial numbers with a copy of the JSS mobile device inventory in XML form. For each match, it creates a temporary XML file that contains the relevant user data from the CSV, and then uses the REST API to update the inventory item.
Obviously, I would strongly STRONGLY suggest you make a backup of your database before running anything like this.
This may be a bit specific to my environment, but this script can be pretty easily tailored to import any kind of information into the Location section of a mobile device inventory asset.
It's very rudimentary right now, and doesn't ask for any input or produce any output. All variables will have to be changed in the script, but the GitHub page includes a sample CSV file that shows the format I was working with.
I hope this helps people. If you have any questions, or issues, please file an issue on GitHub. Happy administrating!
Posted on 07-29-2013 11:44 AM
Thanks for sharing :)
I'll take a look. Don't have a use for it at the moment BUT you can always learn a ton by looking at other people's code :)
Posted on 06-02-2014 09:45 PM
Hi there,
I was wondering if you still had this script available. We have a very similar environment and I was looking for a similar approach. I checked the URL you had provided yet it no longer exists.
Posted on 09-03-2014 07:21 AM
The URL no longer exists, does anyone have a copy?