Skip to main content
Solved

JAMF Recon command not updating certain info


boberito
Forum|alt.badge.img+22

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.

Best answer by mm2270

You may want to double check that the string the variable is receiving is exactly what its required to be for the JSS to recognize the pre-defined department. What I mean is, if its being returned with even so much as an extra space or odd character in it, it may not match up and thus not populate when it gets recon'ed with that info.
You can have it echo the variable out to a text file as part of troubleshooting, and then check the text file afterwards to see what its echoing. It could even be a carriage return or something.

View original
Did this topic help you find an answer to your question?

9 replies

Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • October 7, 2014

Some predefined extension attributes are tied to JSS information and will only populate if it matches something in the list.
ie: Unless there is a department defined as "Class of 22" in the JSS it will not populate.

edit: That's my understanding anyway.


boberito
Forum|alt.badge.img+22
  • Author
  • Jamf Heroes
  • 449 replies
  • October 7, 2014

No you are exactly right. And we have a department named "Class of 22" defined in Casper's list of available departments. It works in the script if I don't use the variable. That's why I'm so confused.


Forum|alt.badge.img+10
  • New Contributor
  • 596 replies
  • October 7, 2014

@Look is correct. The department your wanting to match must already exist in the JSS.


bentoms
Forum|alt.badge.img+35
  • Legendary Contributor
  • 4331 replies
  • October 7, 2014

@boberito, have you got network segments overriding the departments?


boberito
Forum|alt.badge.img+22
  • Author
  • Jamf Heroes
  • 449 replies
  • October 8, 2014

@bentoms Nope, not that I know of. We don't really use network segments at all here.


Forum|alt.badge.img+16
  • Honored Contributor
  • 403 replies
  • October 8, 2014

When is this script being run? Is it possibly being run when a user isn't actually logged into the system?


boberito
Forum|alt.badge.img+22
  • Author
  • Jamf Heroes
  • 449 replies
  • October 8, 2014

First login. All the other information populates perfectly like username, real name, and email.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • October 8, 2014

You may want to double check that the string the variable is receiving is exactly what its required to be for the JSS to recognize the pre-defined department. What I mean is, if its being returned with even so much as an extra space or odd character in it, it may not match up and thus not populate when it gets recon'ed with that info.
You can have it echo the variable out to a text file as part of troubleshooting, and then check the text file afterwards to see what its echoing. It could even be a carriage return or something.


boberito
Forum|alt.badge.img+22
  • Author
  • Jamf Heroes
  • 449 replies
  • October 8, 2014

YES! You were right. I really really appreciate this. I guess I was lucky it was working before.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings