I have a script that worked perfectly the last 2 school years so probably pre-Casper 9. Since we upgraded to Casper 9 mid school year last year.
This script figures out who the current logged in user is and then hits Active Directory to get their AD group which is their graduation class and their full name. We then have departments named the same in Casper. This worked beautifully in the past but seems to have broken some time in the last year. And maybe it's my script but that hasn't changed.
#!/bin/bash
getUser=`ls -l /dev/console | awk '{ print $3 }'`
getclass=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$getUser dsAttrTypeNative:distinguishedName | awk '{ FS=","; print $2 }' | awk '{ FS="="; print $2 }'`
getRealName=`dscl '/Active Directory/ACADEMIC/All Domains' -read /Users/$getUser RealName | grep -v ":"`
jamf recon -endUsername $getUser -department "$getclass" -realname "$getRealName" -email "$getUser@saes.org"
When I do the jamf recon command but manually put -department "Class of 22" instead of using the variable it will set it to the department in Casper named "Class of 22" correctly.
When I check to make sure the variable $getclass has the right value it does (echo $getclass returns Class of 22).
Anyway I wasn't sure if this is a bug? Something I'm doing wrong? Something anyone else has seen? Any help would be greatly appreciated.