Skip to content

A Ruby Gem to use Jamf Pro API for hosted instances to run reports

License

Notifications You must be signed in to change notification settings

nlscott/JamfReports

Repository files navigation

JamfReports

Summary

JamfReports is a ruby gem that uses the Jamf Pro API for hosted instances. Currently, it only reports on Applications. Pulling from the /api/v1/computers-inventory?section=APPLICATIONS endpoint.

Future reports may be added.


Installation

Add this line to your application's Gemfile:

gem 'JamfReports'

And then execute:

$ bundle

Or install it yourself as:

$ gem install JamfReports

Usage

In order to run JamfReports, you are required to add these two lines to the top of your file, under the require JamfReports line

#!/usr/bin/ruby
require "JamfReports"

## UPDATE THESE VARIABLES ------------------------------------------------------
$jamfpro_url = "https://company.jamfcloud.com" 
$api_pw = "Your API KEY HERE"

If you don't have your api key for the $api_pw variable, run this command to create it and paste it into the variable.

printf "jamfUserName:JamfPassword" | iconv -t ISO-8859-1 | base64 -i -

And these 3 lines to generate the api token and pull the data from Jamf so you can run the report commands.

JamfReports.getToken
JamfReports.checkTokenExpiration
JamfReports.getAllApplicationInventory

A full working file might look like this.

#!/usr/bin/ruby
require "JamfReports"

## UPDATE THESE VARIABLES ------------------------------------------------------
$jamfpro_url = "https://company.jamfcloud.com" 
$api_pw = "Your API KEY HERE"

## COMMANDS --------------------------------------------------------------------
JamfReports.getToken
JamfReports.checkTokenExpiration
JamfReports.getAllApplicationInventory

## REPORTS --------------------------------------------------------------------
JamfReports.listAllInstalledApps
# JamfReports.webBrowserReport
# JamfReports.totalNumberOfOneInstalledApps
# JamfReports.listofOneInstallApps

## After reporting, revoke current token
JamfReports.invalidateToken

Examples

listAllInstalledApps

listAllInstalledApps

Returns a sorted list of all apps installed across your fleet of computers in Jamf. Sorted from most installed app, to least.

webBrowserReport

webBrowserReport Returns a list of installed web browsers. Current browsers searched are:

  • Google Chrome.app
  • Google Chrome Canary.app
  • Firefox.app
  • Firefox Developer Edition.app
  • Safari.app
  • Safari Technology Preview.app
  • Microsoft Edge.app
  • Brave Browser.app
  • Arc.app
  • Opera.app
  • LinCastor Browser.app
  • LockDown Browser.app
  • Tor Browser.app
  • Vivaldi.app
  • DuckDuckGo.app

totalNumberOfOneInstalledApps

totalNumberOfOneInstalledApps Returns a single metric to show the number of "One-off" or single installed apps across your fleet.

listofOneInstallApps

listofOneInstallApps

Returns a list of all the "One-off" or single installed apps across your fleet. This can be helpful in scoping in Jamf uninstall policies.

listAllInstalledApps_exporttocsv

listAllInstalledApps_exporttocsv Using JamfReports.listAllInstalledApps_exporttocsv exports the results to the users desktop as a csv file named Installed Applications Report.csv


License

The gem is available as open source under the terms of the MIT License.

About

A Ruby Gem to use Jamf Pro API for hosted instances to run reports

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published