Skip to main content
Question

JAMF extensions attributes script


JamfAdmin2
Forum|alt.badge.img+6

Hello I am new to scripting and i found this script online and i showed it to my boss he said "the script is good and it will work" he then asked me "how would that script look if it were to be in jamf extension" 

 

Here is the script i showed him i am assuming we are going to be using this script in jamf attributes extension but for it to be valid in jamf do i just need to add a results tag? how can this script be acceptable as a jamf extension? 

 

 

9 replies

jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • 741 replies
  • August 29, 2023

code is fine, but what exactly do you want the EA to return.. 


JamfAdmin2
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 59 replies
  • August 29, 2023

we just wanted to get a return of whatever version of slack a user currently has so we would run the script for example and tell us if the user currently has the silicon version of slack or the intel or the universal version of slack 


jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • 741 replies
  • August 29, 2023
JamfAdmin2 wrote:

we just wanted to get a return of whatever version of slack a user currently has so we would run the script for example and tell us if the user currently has the silicon version of slack or the intel or the universal version of slack 


thats cool, but whats the end game? you can just use JAMF apps and scope that for all Slack installs and that will take care of updates.. So you report back the binary version and then.. ? (unless your on prem.. then..) 


JamfAdmin2
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 59 replies
  • August 29, 2023
JamfAdmin2 wrote:

we just wanted to get a return of whatever version of slack a user currently has so we would run the script for example and tell us if the user currently has the silicon version of slack or the intel or the universal version of slack 


one of the things my boss asked me was "how can you update that script so it would work as a jamf extension" i never used jamf extensions before so that is why i asked i wanted to know more 


jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • 741 replies
  • August 29, 2023
JamfAdmin2 wrote:

one of the things my boss asked me was "how can you update that script so it would work as a jamf extension" i never used jamf extensions before so that is why i asked i wanted to know more 


ahh.. ok.. yea.. get whatever you need to parse into an variable..  $usefulldata

echo "<result>$usefulldata</result>"

will enter that into the EA, that you can then scope / report on.. 

if there is no data, I keep the variable empty..  

 

NOTE!! important.. EAs run as ROOT, and will execute what-ever you enter. and for EVERY DEVICE... 

So, every EA you build.. make as a policy / script .. assign, test.. test again. maybe.. again.. THEN add as an EA.. ðŸ˜Ž

 


JamfAdmin2
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 59 replies
  • August 29, 2023
jamf-42 wrote:

ahh.. ok.. yea.. get whatever you need to parse into an variable..  $usefulldata

echo "<result>$usefulldata</result>"

will enter that into the EA, that you can then scope / report on.. 

if there is no data, I keep the variable empty..  

 

NOTE!! important.. EAs run as ROOT, and will execute what-ever you enter. and for EVERY DEVICE... 

So, every EA you build.. make as a policy / script .. assign, test.. test again. maybe.. again.. THEN add as an EA.. ðŸ˜Ž

 


hey can you please do me a favor this script can you run it on your end please it is giving me syntax errors and i do not know why 

 

JamfAdmin2
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 59 replies
  • August 29, 2023
JamfAdmin2 wrote:

hey can you please do me a favor this script can you run it on your end please it is giving me syntax errors and i do not know why 

 

 


JamfAdmin2
Forum|alt.badge.img+6
  • Author
  • Contributor
  • 59 replies
  • August 30, 2023

so with the script i am getting an error on line 7 and i do not know why and i do not know how to resolve the issue please help (:


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • August 30, 2023
JamfAdmin2 wrote:

so with the script i am getting an error on line 7 and i do not know why and i do not know how to resolve the issue please help (:


I see 2 possible things wrong with the script in your image. First, the first line in the case statement should be "x86_64 arm64", not just "x86_64" as you have it now. Otherwise, it will never detect any Universal versions of the application since the command outputs both the x86 and arm64 tags with universal apps.

Second thing, and this may be the reason for your error, is you should have a space between echo and "<result> for each line in your case statement. Spaces are important in shell scripts as they act as delineators between commands and other pieces of information. You can't smush them together like that.


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