Skip to main content
Solved

Run a Jamf script from the command line


Forum|alt.badge.img+1

Is there a Terminal command I can use to manually run, from Terminal, a Jamf script I've created?

Best answer by easyedc

+1 for throwing your script into a policy with a custom trigger and just running that via 

sudo jamf policy -event TRIGGERNAME

 There used to be a

sudo jamf runscript

 command, but it was clunky and hard to use. Looks like they deprecated it at some point and I didn't even notice. 

there's a decent thread on it here with some info on it, but it was clunky and hard to use. 

% jamf help runscript There is an error in your syntax. Error: runscript does not have any help. Type "jamf help" for more information.

 

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

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • January 7, 2022

@Satchmo No, there is not a mechanism to directly run a script in your JSS from the command line using the jamf binary. What you could do however is create a policy containing a Script payload with your script and scoped to all machines but with the only trigger being a custom event. That policy can be triggered from the command line using this syntax: sudo jamf policy -event TriggerNameHere


YanW
Forum|alt.badge.img+11
  • Contributor
  • January 7, 2022

For just 1 or 2 machines, I create the script, use Jamf Remote, select the machine and the script, run and done. If for whatever reason you can't, then @sdagley is right, use the custom trigger.


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • January 8, 2022
YanW wrote:

For just 1 or 2 machines, I create the script, use Jamf Remote, select the machine and the script, run and done. If for whatever reason you can't, then @sdagley is right, use the custom trigger.


@YanW I intentionally ignored Jamf Remote as an option because it's essentially useless for remote Macs connected via VPN, and Jamf has stated it will no longer be distributed in a future version of Jamf Pro (estimated removal date: May-July 2022)


Forum|alt.badge.img+7
  • Valued Contributor
  • January 12, 2022

the custom trigger method is your friend. Jamf Remote, RIP. Good riddance. It  was buggy as hell and more often than not would error on login...it would be useless for days and often require a bounce.   However, there were times when JAMF Remote was awesome for some tasks. It was cool to be able to run policies and commands/scripts on multiple machines in real time. Too bad JAMF never bothered fixing it. 


easyedc
Forum|alt.badge.img+16
  • Esteemed Contributor
  • January 13, 2022

+1 for throwing your script into a policy with a custom trigger and just running that via 

sudo jamf policy -event TRIGGERNAME

 There used to be a

sudo jamf runscript

 command, but it was clunky and hard to use. Looks like they deprecated it at some point and I didn't even notice. 

there's a decent thread on it here with some info on it, but it was clunky and hard to use. 

% jamf help runscript There is an error in your syntax. Error: runscript does not have any help. Type "jamf help" for more information.

 


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • January 13, 2022
easyedc wrote:

+1 for throwing your script into a policy with a custom trigger and just running that via 

sudo jamf policy -event TRIGGERNAME

 There used to be a

sudo jamf runscript

 command, but it was clunky and hard to use. Looks like they deprecated it at some point and I didn't even notice. 

there's a decent thread on it here with some info on it, but it was clunky and hard to use. 

% jamf help runscript There is an error in your syntax. Error: runscript does not have any help. Type "jamf help" for more information.

 


@easyedc The runscript verb was for running a script already on the Mac, not from the JSS. It was deprecated because it ran the script with all of the PPPC allowances in place for the jamf binary, and that was a Very Bad Thing™.


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