Posted on 03-26-2022 11:14 AM
Hello folks,
any chance to run Jamf CLI commands like "sudo jamf policy" or "sudo jamf launchSelfService" from a bash script?
Thanks a lot|
Solved! Go to Solution.
Posted on 03-28-2022 02:39 AM
Try using the fullpath for jamf
/usr/local/bin/jamf
I have found some scripts fail until I use the full path to the command.
Posted on 03-26-2022 12:43 PM
@BusterCasey Run your script via sudo (e.g. sudo ./myscript.sh) and in the script don't prefix the jamf binary cals with a sudo (i.e. use 'jamf policy' instead of 'sudo jamf policy')
Posted on 03-26-2022 02:03 PM
Thank you, It works. I realized that the issue is that i launch the bash script from a Applescript:
do shell script "/path/to/yourscript.sh" with administrator privileges
Every bash commands inside the sh works great (sudo or not) except the jamf cals to the jamf binary. Can't understand why 😥
Posted on 03-28-2022 02:39 AM
Try using the fullpath for jamf
/usr/local/bin/jamf
I have found some scripts fail until I use the full path to the command.
03-28-2022 08:17 AM - edited 03-28-2022 08:20 AM
I Set a policy up in self service to be able to run what I call a check in.
#!/bin/bash
sudo jamf policy; sudo jamf recon
Even gave it an icon. That way I can scope something out and tell a user to go to self service and check in so we don't have to wait..
Posted on 03-28-2022 10:27 AM
User the full path: /usr/local/bin/jamf
I have to do this with commands in Apple Remote Desktop
Posted on 03-29-2022 07:21 AM
The easy way to find the full path for any command is to use the which command in terminal,
so
which jamf
Returns
/usr/local/bin/jamf