Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Generating the Installer Script

Matthew Warren edited this page Feb 25, 2017 · 4 revisions

In this repository's parent directory, you'll find generator.py. This script will process your CSV of printer queues (See: Creating Printer Queue Definitions) and output a usable printer-installer.py script, which you will upload to your JSS.

Running generator.py

  1. Clone the repository cd into its parent directory
  2. Execute python generator.py /path/to/config.json /path/to/printers.csv, substituting the actual path to your printer CSV file

Note: The paths to your config.json file and printer inventory CSV file are required arguments.

The CSV will be read in, converted to a JSON document, saved as a JSON file to the output/ directory for reference, then injected into a template Python script. This results in printer-installer.py being created (or updated) in the output/ directory.

Note: If you run the generated printer-installer.py locally to test, make sure you do so via sudo. The call to the jamf binary therein requires root privileges.

Excluding Printers

While you can filter the list of printers displayed to the user, you may wish to completely exclude a group of printers from being included in the installer script. This is useful if you generate your printer inventory CSV from some external process that includes all printers on your print server, including "restricted" devices not generally available to any end user.

Simply create a plaintext file that lists the DisplayName attribute – one per line – of printers you wish to exclude:

CEOsPersonalPrinter
FinanceDeptCheckPrinter
ExpensiveFoilEmbossedLetterheadPrinter

Pass the path of your exclusions file as a secondary argument when executing generator.py:

python generator.py /path/to/config.json /path/to/printers.csv /path/to/exclusions.txt