Posted on 04-20-2016 07:58 AM
Hey guys, I'm looking to have my department, maybe even building set automatically during imaging. I have 3 department groups; staff, admin, and student. We are using and AD right now, but until we re-organize it, I cannot rely on it to pull department info correctly. I was wondering if anyone knew how to script this out? I'm not sure if the API is needed. Thank You!
Posted on 04-20-2016 09:10 AM
I have a set of scripts I use to set departments (one script per department):
#!/bin/sh
#SetDepartmentFieldinCasper#
#SetDeptasVariable#
vdept="Your_dept"
#set the dept in Casper#
jamf recon -skipApps -skipFonts -skipPlugins -department $vdept
Posted on 04-21-2016 03:05 AM
Posted on 04-21-2016 06:44 AM
Hey @Lhsachs, I just tried out that script and I wasn't able to populate any Department settings. I'm not sure if it's related to @bentoms post. Have you been imaging with those recently? I know an alternative way, is using prestage images, but I have a feeling we may miss updating those manually when machines change hands or switch departments. Thank You!
Posted on 04-21-2016 07:22 PM
I ran the script today to test... and it worked fine... The scripts are normally used by groups I don't control - who image their own macs... and filling in the department helps us with asset management.
The department names they fill with are already choices for the department field
Posted on 04-25-2016 06:43 AM
It's working perfectly thank you. I just realized I had a space in my department name and I wasn't entering that correctly into the script. Thanks Again for the help!
Posted on 05-17-2016 10:21 AM
Is this still working for you? I'm running JSS 9.91 and i'm currently having a problem with running the script during imaging. Everything installs fine on the image but it never runs the script to change the department. I have a policy set up so I can call the script in self service and when I do that it works just fine. No other scripts are set up to run during imaging and I have the priority set to After.
Posted on 05-24-2017 07:05 AM
I just took another look back into this. I haven't needed that script to actually work for a while during imaging, but it looks like its not working now. Ive tried the script at reboot, in a payload free pkg to install on reboot, and even a script running at reboot that just triggers a policy containing that script or pkg and nothing is working in an automated way. I can run the commands manually or via self service and they still work that way.