Jamf Blog
October 21, 2021 by Haddayr Copley-Woods

Turn 1000 clicks into 1 with python-Jamf and jctl

This JNUC 2021 how-to session introduces this jctl cli tool, which interacts with Jamf Pro or Jamf Cloud and allows administrators to perform repetitive tasks quickly and easily. The python-jamf library simplifies interacting with the Classic API and powers jctl.

Jamf Pro automations: How to automate any repetitive and complex task you want

This Jamf Pro automations session on how to use python-jamf and jctl library offers examples, shows how it works internally, and shows how easy it is to add your own functionality to perform and automate any repetitive and complex task you want.

Presenters include:

  • James Reynolds, Senior Systems Administrator, The University of Utah
  • Richard Glaser, Assistant Head, Client Platform Services, University of Utah, Marriott Library
  • Sam Forester, MX Technologies
  • Topher Nadauld, Jamf Engineer, KDInfoTech

Intro and background of tools and development

Why did they develop these tools?

The developers sought something that would:

  • Save time and focus
  • Reduce errors and improve consistency
  • Remove manual processes, which are prone to error
  • Allow for scalability

Richard Glaser also discusses the development history of the tool, which originated as a patch management tool.

Under the hood: how python-jamf works internally

Sam Forster discusses the fundamental structure for handling the API in Python3, which uses:

  • requests
  • xml.etree
  • plistlib
  • keyring
  • jamf.records

This simple but powerful tool updates Jamf records in less than 15 lines, converts XML to Python (and visa versa) and supports all Legacy API calls.

Forster discusses configuration, additional object support for Jamf server objects and ideas for using the tool in a variety of ways. This easily-adapted tool is available on PyPi.

Usage Examples of Workflows

Topher Naduald covers jctl Functions: a simple tool to perform actions that would take many actions to perform such as GUI-based searches; modifying policies, scopes, or computer groups; and updating patch policies.

Naduald shows a few examples in detail, including how to: list all computers, list computers with a specific name, handle policies with logout triggers, review all Self Service descriptions and remove computers that haven’t checked in since the previous year.

Advanced usage and package management

James Reynolds discusses, in detail and with examples, subcommands for specific object types. He also shows how these subcommands can be filtered and introduces jumpstarting with jctl packages. Reynolds outlines how to create a new patch title, add packages, create patch policies and promote packages.

Reynolds also introduces a new jctl tool: Package Control (pkgctl), which gives you access to even more without coding Python, all from the Command Line.

Register for JNUC to access this session as well as other sessions on demand.

Subscribe to the Jamf Blog

Have market trends, Apple updates and Jamf news delivered directly to your inbox.

To learn more about how we collect, use, disclose, transfer, and store your information, please visit our Privacy Policy.