-
Notifications
You must be signed in to change notification settings - Fork 6
jamfuploader‐run.sh
JamfUploader-Run is a script for uploading items to a Jamf Pro instance using the AutoPkg framework and JamfUploader processors, without having to write AutoPkg recipes.
AutoPkg needs to be installed. To do this as simply as possible, I would recommend following the instructions in the README file of the AutoPkgSetup repo to get the autopkg-setup.sh file downloaded.
Alternatively, as a bare minimum, install the latest version of AutoPkg using the installer package available on the AutoPkg Releases page.
Once installed, add the jamf-upload repo using the following command:
autopkg repo-add grahampugh/jamf-upload
This script provides Jamf Pro API credentials to an underlying script (jamf-upload.sh). The actions that wish to be performed must be supplied at the command line using parameters. Instance selection is possible either interactively, or using parameters.
The parameters depend on what action you are performing. You can see all options by running jamfuploader-run.sh --help. This will output both the help sheet of jamf-upload.sh and the options for jamfuploader-run.sh itself.
Instances can be chosen interactively when running the script. However, you may also specify the instances using command line parameters if desired.
To interactively select the instance list and instances, run the tool without any instance parameters. You will be first asked to select one or more instance lists, and then asked to select the instances you wish to act upon:
./jamfuploader-run.sh <action> <action-options>You can pre-select an instance list so that you aren't asked to select one. To do this, add the -il or --instance-list option, and the name of the instance list, omitting the .txt suffix. Remember that the instance list must be in the instance-list folder within the multitenant-jamf-tools folder unless an alternative location is specified in the AutoPkg preferences.
If you pre-select an instance list but not an instance, you will be asked to select an instance list via interactive menu.
Example:
./jamfuploader-run.sh --instance-list prod <action> <action-options>You can pre-select one instance so that you aren't asked to select one. This can be done in conjunction with a pre-selected instance list, so that you can run the command non-interactively. If the instance is not in the instance list, you will be asked to select a valid instance from the list.
Example:
./jamfuploader-run.sh --instance-list prod --instance https://myinstance.jamfcloud.com <action> <action-options>You may also supply a URL without the script verifying that it is in a supplied instance list using the --nointeraction flag. Remember that the credentials for the instance need to be stored in the Keychain for it to work.
Example:
./jamfuploader-run.sh --instance https://myinstance.jamfcloud.com --nointeraction <action> <action-options>To run the command on all instances in a specified instance list, use the --all option.
./jamfuploader-run.sh --instance-list prod --all <action> <action-options>The list of possible actions is provided below. These are supplied to the command line in the form ./jamfuploader-run.sh <action> <parameters>. Each action has a minimum set of required parameters. For details of each action and a list of required parameters, run jamfuploader-run.sh --help.
account
apiclient
apirole
category
delete | objdelete | objectdelete
group | computergroup
groupdelete | computergroupdelete
mobiledevicegroup
profile | computerprofile
mobiledeviceprofile
ea | extensionattribute | computerextensionattribute
eapopup | eapopupadjuster
icon
jira
logflush
macapp
mobiledeviceapp
msu | managedsoftwareupdateplan
obj | object | classicobj
patch
pkg | package
pkgdata
pkgclean
pkgcalc | packagerecalculate
policy
policydelete
policyflush
read
restriction | softwarerestriction
scope
script
slack
teams
unusedpkgclean
The most typical use case is to upload a package. To do this, the most basic option is to run a command like as follows:
./jamfuploader-run.sh pkg --pkg /path/to/package.pkgTo add a category to the package as you upload it, you can add --category NameOfCategory. Note that the category must exist.
If you want to replace an existing package, add the --replace option.
If your instance has more than one File Share Distribution Point and you want to specify which one the package should be uploaded to, you can filter the distribution point using
--dp FILTERNAME. For example, if you want to restrict to a DP that hascompany.comin the server FQDN, add--dp server.com.
Putting all that together, you would run:
./jamfuploader-run.sh pkg --pkg /path/to/package.pkg --category NameOfCategory --dp company.com --replaceIf your organisation has local file share distribution points, you may have a separate mechanism for putting the package in the DP, but still need to add the package metadata so that it shows in Jamf. To do this you can use the pkgdata option. No package path is required, instead you provide the package name. If you provide the path to a package, the package name will be extracted and used. Example:
./jamfuploader-run.sh pkgdata --pkg package.pkg --category NameOfCategory --replaceYou can obtain a list of all objects of a specific type, which can be outputted to a file for reporting or troubleshooting purposes. As an example, this command will download a list of all computer profiles and output it to a JSON file in the Downloads directory with the name <instance>-os_x_configuration_profiles.json:
./jamfuploader-run.sh read --type os_x_configuration_profile --list --output ~/DownloadsHere is a list of all possible objects that can be read from which lists may be created:
account_user
account_group
advanced_computer_search
advanced_mobile_device_search
api_client
api_role
app_installers_deployment
app_installers_title
category
cloud_ldap
computer
computer_extension_attribute
computer_group
computer_prestage
configuration_profile
distribution_point
dock_item
enrollment_customization
ldap_server
mac_application
managed_software_updates_available_updates
managed_software_updates_plans
managed_software_updates_update_statuses
mobile_device
mobile_device_application
mobile_device_extension_attribute
mobile_device_group
mobile_device_prestage
network_segment
package
patch_policy
patch_software_title
os_x_configuration_profile
policy
restricted_software
script
volume_purchasing_location
Similar to above, you can download the full XML or JSON for every object of a specific type. For scripts, script-based extension attributes, and configuration profiles, the payload is also extracted into its own file.
As an example, this command will download all computer profiles and output each one to a XML file in the Downloads directory, with the name <instance>-os_x_configuration_profiles-<Object Name>.xml, and extract each embedded profile into <instance>-os_x_configuration_profiles-<Object Name>.mobileconfig:
./jamfuploader-run.sh read --type os_x_configuration_profile --all --output ~/Downloads