Posted on 06-05-2020 05:44 AM
I have a CSV with a list of all the departments and buildings. Is there an easy way to bulk import it into Jamf? I looked at MUT, but don't see how to do it with that. I think it can be done with the API as well, but if anyone has a working solution it would be helpful.
Thank you
Posted on 06-05-2020 09:14 AM
Posted on 12-15-2020 07:10 AM
I used https://pypi.org/project/python-jamf/ to create a small script to store current departments in a file and upload new ones. Let me know if you're interested in a cleaned up version of the code.
Posted on 01-31-2021 09:20 PM
@yoopersteeze those scripts you listed worked great. In particular I used the Make Departments one to import a list of about 450 departments.
I did have to make a change to that script/input file for a couple of things though.
In the script it requires a CSV file that has each new line separated by comma.
The script itself is then set to "nuke" the comma as it parses the CSV so that each entry in Jamf doesn't include it.
In my case I pulled the departments from our AD but some of these departments have commas in the actual department name...
So for my input CSV file instead I changed it to have each new line separated by colon.
Then in the script I changed line 62 from:
deptName=$(echo ${lines[i]} | sed 's/,//g' | tr -d '
')
to
deptName=$(echo ${lines[i]} | sed 's/://g' | tr -d '
')
That way instead of nuking the comma it nukes the colon and I am able to keep commas in my department names for those that have one.
As well, some department names had ampersand "&" and since this is writing to XML it won't parse correctly.
So in the input CSV file I escaped this by changing all the ampersand "&" to:
&
This will allow the use of ampersand "&" in department names (otherwise the script will error out for those entries).
Also, when manipulating the CSV file in Excel and saving as comma delimited for name entries that have commas it might want to wrap them in double quotes. If this happens the double quotes would actually show up in Jamf with the department name. So a text editor can be used to check the input CSV file for double quotes or other oddities.
Posted on 09-29-2022 02:54 PM
Those script links are currently dead, do you have a copy of the script to share?
Posted on 09-30-2022 07:47 AM
found a working script, thanks! https://github.com/jamf/API_Scripts/blob/master/CreateBuildingFromCSV.sh
Posted on 02-03-2021 09:25 AM
Thanks for the info i will try to figure it out for more
Posted on 02-03-2021 01:58 PM
Use the Mut v5. It has a template that has about 15-20 different fields that you can populate at one time. https://apps.apple.com/us/app/mut/id1133234759?mt=12