Edit a policy’s version number via the Classic API
About
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
With inspiration from @mm2270‘s API scripts, and lots of feedback from @Leslie, Jamf Pro Policy Editor Lite was born.
Requirements
API
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
Policies
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.
Packages
The updated package must be present before running this script.
Usage
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
Warning
While the script does backup a policy’s XML before performing updates, please thoroughly test before using in production.
Special Thanks
Script
Latest version on GitHub.
Version 1.4.4
Version 1.4.4 is now available on GitHub
Inspired by @grahamrpugh‘s erase-install, Jamf Pro Policy Editor Lite, version 1.4.4, now includes the following flags:
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 foundry
, auto-answer 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
Presentations
- Personal edit of JNUC 2020
- October 2019 U of U MacAdmins