Scripts
You can manage and run scripts in your environment by using Jamf Pro or Jamf Admin.
When you add a script to Jamf Pro or Jamf Admin, you can configure the following script settings:
Add the script to a category. For more information, see Categories.
Enter parameter labels.
Specify operating system requirements for running the script.
When you add, edit, or delete a script in Jamf Admin, the changes are reflected in Jamf Pro and vice versa.
Script Storage
Before you can run a script, the script must exist in the Jamf Pro database. Scripts are automatically added to the database after they are added to Jamf Pro or Jamf Admin.
Adding a Script to Jamf Pro
If your environment is one in which scripts are stored in the Jamf Pro database, you can add a script to Jamf Pro using the script editor.
Adding a Script to Jamf Admin
Adding a script to Jamf Admin adds the script to the Jamf Pro database and to Jamf Pro.
To add a script to Jamf Admin, the script file must be non-compiled and in one of the following formats:
-
Perl (.pl)1
-
Bash (.sh)
-
Shell (.sh)
-
Non-compiled AppleScript (.applescript)
-
C Shell (.csh)
-
Zsh (.zsh)
-
Korn Shell (.ksh)
-
Tool Command Language (.tcl)
-
Hypertext Preprocessor (.php)3
-
Ruby (.rb)1
-
Python (.py)12
1 These scripting runtimes are deprecated as of macOS 10.15. They may be removed in a future version of macOS. To avoid issues, we recommended either using alternative scripting runtimes or deploying and managing your own runtimes on managed computers.
2 macOS 12 automatically installs Python 2.7 for compatibility purposes. However, when using Jamf Pro to execute scripts that call on Python on computers running macOS 12, users may be presented with an alert stating that Jamf needs to be updated.
3 Hypertext Preprocessor (.php) is not installed by default on computers with macOS 12 or later.
The script is now added to Jamf Pro and the Jamf Pro database.
Editing or Deleting a Script Using Jamf Admin
The edit or delete action is applied immediately.
Running Scripts Using a Policy
When you run a script, you can choose a priority for running the script. You can also enter parameter values for the script.
When running a script that contains HTML tags in the output, the tags are not rendered in policy logs.
To run a script on computers, the script must be stored on the distribution point you plan to deploy it from and in Jamf Pro, or in the Jamf Pro database.
- In Jamf Pro, click Computers
at the top of the sidebar.
- Click Policies
in the sidebar.
- Click New
.
- Use the General payload to configure basic settings for the policy, including the trigger and execution frequency.
- Select the Scripts payload and click Configure.
- Click Add for the script you want to run.
- Configure the settings for the script.
- Use the Restart Options payload to configure settings for restarting computers.
- Click the Scope tab and configure the scope of the policy.
- (Optional) Click the Self Service tab and make the policy available in Self Service.
- (Optional) Click the User Interaction tab and configure messaging and deferral options.
- Click Save
.
The policy runs on computers in the scope the next time they check in with Jamf Pro and meet the criteria in the General payload.