I am trying to get this script to work for this extension attribute. It's just not pulling anything in Jamf Pro. But when I run the same commands in terminal on the local machine, as root, it works. Any suggestions?
I am trying to get this script to work for this extension attribute. It's just not pulling anything in Jamf Pro. But when I run the same commands in terminal on the local machine, as root, it works. Any suggestions?
@JMontey1 In the EA listing you show you're missing a / at the beginning of the path to version.txt file.
You might also want to re-think your check for the current user. Here's a pretty definitive writeup on the best way to do that: https://scriptingosx.com/2020/02/getting-the-current-user-in-macos-update/
This command has always worked for me.
currentUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
I have this in a text document along with a bunch of other commonly used commands and functions that I copy and paste into my scripts. I have always wondered if the other commands worked better in certain use cases or when used with a different interpreter.
The currentUser part works fine. I know there's other options.
The / was missing before "Users" in the file path, that was ultimately what fixed the script.
Thank you all for your help and suggestions. I am slowly throwing myself in the scripting fire so this is all new and exciting.
The currentUser part works fine. I know there's other options.
The / was missing before "Users" in the file path, that was ultimately what fixed the script.
Thank you all for your help and suggestions. I am slowly throwing myself in the scripting fire so this is all new and exciting.
You picked the best place to get help. Many Jamf Nation members have helped me learn to script better. @sdagley is one of them. Mac Admins Slack is another great place to get help.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.