Edit a policy’s version number via the Classic API
Since Jamf Pro PI-005903, I’ve been thinking of a faster way to update policies.
Last week, Adobe released six updates which — outside of building new packages via Adobe’s admin console — effectively required only incrementing a version number four places in each policy (please don’t tell @talkingmoose):
- Adobe After Effects CC 15.1.1 was update to: Adobe After Effects CC 15.1.2
- Adobe Media Encoder CC 12.1.1 was update to: Adobe Media Encoder CC 12.1.2
- Adobe Bridge CC 8.0.1 was update to: Adobe Bridge CC 8.1
- Adobe Premiere Pro CC 12.1.1 was update to: Adobe Premiere Pro CC 12.1.2
- Adobe Prelude CC 7.1 was update to: Adobe Prelude CC 7.1.1
- Adobe XD CC 9.1.12 was updated to: Adobe XD CC 10.0.12
To utilize this script, the API account must have the following privileges:
- Policies: CREATE, READ, UPDATE
- Because of the need to use API credentials with Create privileges, the script allows you to interactively enter the credentials so they don’t need to be stored within the script. (Thanks, mm2270)
- The script performs only minor error checking; please ensure proper API credentials or you will encounter errors
If policies include the version number in parenthesis, for example: “Adobe Prelude CC 2018 (7.1.1)”, the script will automatically parse the version number, for example: “7.1.1”; otherwise, you will be prompted for the version number.
The updated package must be present before running this script.
This script was designed to be run interactively in Terminal and allows you to use the API (along with valid API credentials) to update a policy’s version number.
This script uses some BASH specific items; please first make the script executable:
chmod +x /path/to/Jamf Pro Policy Editor Lite.sh
To use the script:
/path/to/path/to/Jamf Pro Policy Editor Lite.sh
While the script does backup a policy’s XML before performing updates, please thoroughly test before using in production.
Latest version on GitHub.
bash ./policy-editor-lite.bash --help Jamf Pro Policy Editor Lite, 1.4.4 by Dan K. Snelson (@dan-snelson) Usage: bash ./policy-editor-lite.bash [--filter] [--auto] [--version] [--debug] [no flags] Displays all polcies If API variables are left blank, you will be prompted to interactively enter. If you have multiple lanes, fill-in variables in the "laneSelection" function. --filter ... Filters policy names --auto Auto-answers "yes" to prompt Nos. 2, 5 and 6 --version Specifies the new version number --debug Enables debug mode --help Displays this message and exits
For example, the following command will filter policies names containing
Y to prompt numbers 2, 5 and 6, and pre-populate
7.2.0 for the version number for prompt number 4.
bash ./policy-editor-lite.bash --filter foundry --auto --version 7.2.0