-
-
Notifications
You must be signed in to change notification settings - Fork 40
jamf upload.sh
jamf-upload.sh
is a wrapper script for utilising the JamfUploader AutoPkg processors without recipes.
My primary use-case for this is testing new features and bugs in the processors, but it could be used for standalone workflows, as a replacement for the Standalone upload scripts.
Use Requires AutoPkg to be installed, but it shouldn't need to be configured. However, you do need to supply credentials to interact with Jamf Pro, either using the --url
, --user
and --pass
options, or by pointing to a prefs file containing those values (e.g. an existing AutoPkg prefs file), with the --prefs
option.
Here are the possible options:
Usage:
./jamf-upload.sh [object_type] [--help] [arguments]
Valid object types:
account
category
group | computergroup
groupdelete | computergroupdelete
mobiledevicegroup
profile | computerprofile
mobiledeviceprofile
ea | extensionattribute
icon
ldap_server
logflush
macapp
patch
pkg | package
pkgdata
pkgclean
pkgcalc | packagerecalculate
policy
policydelete
policyflush
restriction | softwarerestriction
script
slack
teams
Arguments:
--prefs <path> Inherit AutoPkg prefs file provided by the full path to the file
-v[vvv] Set value of verbosity
--url <JSS_URL> The Jamf Pro URL
--user <API_USERNAME> The API username
--pass <API_PASSWORD> The API user's password
--clientid <ID> An API Client ID
--clientsecret <string> An API Client Secret
--recipe-dir <RECIPE_DIR>
Account arguments:
--name <string> The name
--type <string> The account type. Must be 'user' or 'group'.
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Category arguments:
--name <string> The name
--priority <int> The priority
--replace Replace existing item
Computer Group arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Computer Group Delete arguments:
--name <string> The computer group name
Computer Profile arguments:
--name <string> The name
--template <path> XML template
--payload <path> A profile payload
--mobileconfig <path> A mobileconfig file
--identifier <string> Identifier for the profile
--category <string> The category. Must exist.
--organization <string> Organisation for the profile
--description <string> Description for the profile
--computergroup <str> Computer Group to set as target in the profile
--key X=Y Substitutable values in the script. Multiple values can be supplied
--replace Replace existing item
--retain-scope Retain existing scope when updating an item
Dock Item arguments:
--name <string> The name
--type <string> Type of Dock Item - either 'App', 'File' or 'Folder'
--path <string> Path of Dock Item - e.g. 'file:///Applications/Safari.app/'
--replace Replace existing item
Extension Attribute arguments:
--name <string> The name
--script <path> Full path of the script to be uploaded
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Icon arguments:
--icon <path> Full path to an icon file
--icon-uri <url> The icon URI from https://ics.services.jamfcloud.com/icon
LDAP Server arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mac App Store App arguments:
--name <string> The name
--cloned-from The name of the Mac App Store app from which to clone
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mobile Device Group arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mobile Device Profile arguments:
--name <string> The name
--template <path> XML template
--mobileconfig <path> A mobileconfig file
--identifier <string> Identifier for the profile
--category <string> The category. Must exist.
--organization <string> Organisation for the profile
--description <string> Description for the profile
--mobiledevicegroup <string>
Mobile Device Group to set as target in the profile
--key X=Y Substitutable values in the script. Multiple values can be supplied
--replace Replace existing item
Package arguments:
--name <string> The package display name
--pkg_name <path> The package filename
--pkg <path> Full path to the package to upload
--priority <int> The priority
--category <string> The category. Must exist.
--smb-url <url> URL of the fileshare distribution point (on premises Jamf Pro only)
--smb-user <SMB_USERNAME>
Username with share access
--smb_pass <SMB_PASSWORD>
Password of the user
--info <string> Pkg information field
--notes <string> Pkg notes field
--reboot_required Set the 'reboot required' option
--os-requirement <string>
Set OS requirement for the pkg
--required-processor <string>
Set CPU type requirement for the pkg
--send-notification Set to send a notification when the package is installed
--replace-pkg-metadata Set to replace the pkg metadata if no package is uploaded
--skip-metadata-upload Set to skip pkg metadata upload
--replace Replace existing item
--jcds Deprecated, ignored
--jcds2 Use jcds endpoint for package upload to JCDS
--aws Use AWS CDP for package upload. Requires aws-cli to be installed
--api Use v1/packages endpoint for package upload to cloud DP
--recalculate Recalculate packages if using --jcds2 or --api modes
Package Clean arguments:
--name <string> The name to match
--smb-url <url> URL of the fileshare distribution point (on premises Jamf Pro only)
--smb-user <SMB_USERNAME>
Username with share access
--smb_pass <SMB_PASSWORD>
Password of the user
Package Metadata arguments:
--name <string> The package display name
--pkg <path> The package filename
--priority <int> The priority
--category <string> The category. Must exist.
--info <string> Pkg information field
--notes <string> Pkg notes field
--reboot_required Set the 'reboot required' option
--os-requirement <string>
Set OS requirement for the pkg
--required-processor <string>
Set CPU type requirement for the pkg
--send-notification Set to send a notification when the package is installed
--replace Set to replace the pkg metadata if no package is uploaded
Package Recalculate arguments: None
Policy arguments:
--name <string> The name
--template <path> XML template
--icon <path> Full path to an icon file for Self Service policies
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
--replace-icon Set to replace the existing icon if it has the same name
--retain-scope Retain existing scope when updating an item
Policy Delete arguments:
--name <string> The policy name
Policy Log Flush arguments:
--name <string> The policy name
--interval The log flush interval
Patch Policy arguments:
--name <string> The patch policy name
--pkg <path> Name of the package to uplaod
--version <string> The package (or app) version
--title <string> The patch software title
--template <path> XML template
--policy <string> Name of an existing policy containing the desired icon for the patch policy
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Script arguments:
--name <string> The name
--script <path> Full path of the script to be uploaded
--key X=Y Substitutable values in the script. Multiple values can be supplied
--parameter[4-11]
Script parameter labels
--replace Replace existing item
Software Restriction arguments
--name <string> The name
--template <path> XML template
--process-name Process name to restrict
--display-message Message to display to users when the restriction is invoked
--match-exact-process-name
Match only the exact process name if True
--send-notification Send a notification when the restriction is invoked if True
--kill-process Kill the process when the restriction is invoked if True
--delete-executable Delete the executable when the restriction is invoked if True
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Slack arguments:
--name <string> The name
--policy-category <string>
The POLICY_CATEGORY
--pkg-category <string> The PKG_CATEGORY
--pkg_name <string> The package name
--version <string> The package (or app) version
--pkg-uploaded Pretends that a package was uploaded (sets a value to jamfpackageuploader_summary_result)
--policy-uploaded Pretends that a policy was uploaded (sets a value to jamfpolicyuploader_summary_result)
--slack-url <url> The slack_webhook_url
--slack-user <string> The Slack user to display
--icon <url> The Slack icon URL
--channel <string> The Slack channel to post to
--emoji <string> the Slack icon emoji
Teams arguments:
--name <string> The name
--policy-category <string>
The POLICY_CATEGORY
--pkg-category <string> The PKG_CATEGORY
--patch_name <string> The patch policy name
--pkg_name <string> The package name
--version <string> The package (or app) version
--patch-uploaded Pretends that a patch was updated (sets a value to jamfpatchuploader_summary_result)
--pkg-uploaded Pretends that a package was uploaded (sets a value to jamfpackageuploader_summary_result)
--policy-uploaded Pretends that a policy was uploaded (sets a value to jamfpolicyuploader_summary_result)
--teams-url <url> The teams_webhook_url
--teams-user <string> The Teams user to display
--icon <url> The Teams icon URL
As a minimum, the --prefs
need to have the Jamf Pro Server credentials in it.
./jamf-upload.sh category \
--prefs ~/Library/Preferences/com.github.autopkg.plist \
--name JamfUploadTest \
--priority 18 \
-vv
./jamf-upload.sh pkg \
--prefs ~/Library/Preferences/com.github.autopkg.plist \
--pkg python_recommended_signed-3.9.5.09222021234106.pkg \
--category JamfUploadTest \
-v
In this example, we are supplying a template (ProfileTemplate-test-users.xml
), and a payload .plist
file (com.bombich.ccc.plist
). Note that we need to supply a --recipe-dir
parameter, even though we are not using a recipe. This acts as a fake repo base directory, under which the JamfUploader processors will look for the templates that are specified. Otherwise you may be able to supply the full path to each template:
./jamf-upload.sh profile \
--prefs ~/Library/Preferences/com.github.autopkg.plist \
--name "Carbon Copy Cloner" \
--recipe-dir /path/to/folder-with-templates \
--template ProfileTemplate-test-users.xml \
--payload com.bombich.ccc.plist \
--identifier com.bombich.ccc \
--category JamfUploadTest \
--organization "Graham Pugh Inc." \
--description "Amazing test profile" \
--computergroup "Testing" \
-vv \
--key REGISTRATION_CODE="FAKE-CODE" \
--key REGISTRATION_EMAIL="no@yes.com" \
--key REGISTRATION_NAME="MyCorp License Administration" \
--key REGISTRATION_PRODUCT_NAME='Carbon Copy Cloner 6 Volume License' \
--replace
In this example, we are supplying a template (RestrictionTemplate-singlegroup.xml
). Note that we need to supply a --recipe-dir
parameter, even though we are not using a recipe. This acts as a fake repo base directory, under which the JamfUploader processors will look for the templates that are specified. Otherwise you may be able to supply the full path to each template:
./jamf-upload.sh restriction \
--prefs ~/Library/Preferences/com.github.autopkg.plist \
--name "Restrict Carbon Copy Cloner" \
--recipe-dir /path/to/folder-with-templates \
--template RestrictionTemplate-singlegroup.xml \
--process_name "Carbon Copy Cloner" \
--display_message "Carbon Copy Cloner is not allowed." \
--match_exact_process_name \
--kill_process \
--computergroup Testing \
-vvv \
--replace