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.

  • Choose a priority for running the script during imaging.

  • 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.

  1. Log in to Jamf Pro.

  2. In the top-right corner of the page, click Settings images/download/thumbnails/82682685/Icon_Settings_Hover.png .

  3. Click Computer Management.

  4. In the “Computer Management” section, click Scripts images/download/thumbnails/82682685/Scripts.png .

  5. Click New images/download/thumbnails/82682685/Icon_New_Button.png .

  6. Use the General pane to configure basic settings for the script, including the display name and category.

    Note: If you do not add the script to a category, Jamf Admin displays the script in blue text in the Unknown category.

  7. Click the Script tab and enter the script contents in the script editor. You can use the settings on the tab to configure syntax highlighting and theme colors in the script editor.

  8. Click the Options tab and configure additional settings for the script, including the priority.

  9. (Optional) Click the Limitations tab and configure operating system requirements for the script.

  10. Click Save images/download/thumbnails/81531754/floppy-disk.png .

Adding a Script to Jamf Admin

Requirements

To add a script to Jamf Admin, the script file must be non-compiled and in one of the following formats:

  • Perl (.pl)

  • Bash (.sh)

  • Shell (.sh)

  • Non-compiled AppleScript (.applescript)

  • C Shell (.csh)

  • Zsh (.zsh)

  • Korn Shell (.ksh)

  • Tool Command Language (.tcl)

  • Hypertext Preprocessor (.php)

  • Ruby (.rb)

  • Python (.py)

Procedure

Adding a script to Jamf Admin adds the script to the Jamf Pro database and to Jamf Pro.

  1. Open Jamf Admin and authenticate to the Jamf Pro server.

  2. Drag the script to the main repository in Jamf Admin.
    The script is displayed in blue text in the Unknown category until you add it to a category.

  3. Double-click the script in the main repository.

  4. Click the General tab and configure basic settings for the script, including the display name and category.
    images/download/attachments/82682685/Script_General.png

  5. Click the Options tab and configure additional settings for the script, including the priority and parameter labels.

    images/download/attachments/82682685/Script_Options.png
  6. Click OK.

The script is now added to Jamf Pro and the Jamf Pro database.

Editing or Deleting a Script Using Jamf Admin

  1. Open Jamf Admin and authenticate to the Jamf Pro server.

  2. In the main repository, select the script you want to edit or delete.

  3. Do one of the following:

    • To edit the script, double-click it and make changes as needed. Then click OK.

    • To delete the script, click Delete images/download/thumbnails/82682685/icon_CA_delete.png , and then click Delete again to confirm.

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.

Note: When running a script that contains HTML tags in the output, the tags are not rendered in policy logs.

Requirements

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.

Procedure

  1. Log in to Jamf Pro.

  2. Click the Computers tab at the top of the page.

  3. Click Policies.

  4. Click New images/download/thumbnails/82682685/Icon_New_Button.png .

  5. Use the General payload to configure basic settings for the policy, including the trigger and execution frequency.

  6. Select the Scripts payload and click Configure.

  7. Click Add for the script you want to run.

  8. Configure the settings for the script.

  9. Use the Restart Options payload to configure settings for restarting computers.

  10. Click the Scope tab and configure the scope of the policy.

  11. (Optional) Click the Self Service tab and make the policy available in Self Service.

  12. (Optional) Click the User Interaction tab and configure messaging and deferral options.

  13. Click Save images/download/thumbnails/81531754/floppy-disk.png .

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.

Related Information

For related information, see the following sections in this guide:

Copyright     Privacy Policy     Terms of Use     Security
© copyright 2002-2021 Jamf. All rights reserved.