Pushing a command file over JAMF and retrieving a results file

CAP
New Contributor

I am not very familiar with JAMF, however I have a school that I am running a network assessment for that manages all of their devices with JAMF. I want to use RapidFire's .command file to gather information from the mac workstations as they have about 150 mac devices. When I look into pushing a script from JAMF it seems like it would be possible to use the .command file that RapidFire provides. Assuming I can get this to work, what would be the best way to retrieve the output file also using JAMF? I guess I could write a script to grab the file and move it to some network share but I am wondering if there is a better way.

4 REPLIES 4

nelsoni
Contributor III

If I am understanding your correctly, you should look into extension attributes. It is just a script that you create in Jamf and have it run on your Macs that will then return a result that you can poplate in the Jamf console for each machine. You can even run profiles off of smart groups that go off of the result of the extension attribute you wrote.

alexjdale
Valued Contributor III

Depending on the size of the output file and how you need to access/organize the results, either an extension attribute or copying it off to a network share would work. In the past I've created a "dropbox" write-only share where I could copy files with a script (mounting the share and copying it with shell commands, after renaming the file to reflect the computer name).

If you just need a small piece of data from the output, then I'd go with an extension attribute that parses it out from the file. You could just put into a report, so you'd have all the results in one place. My guess is that .command is just a script, and could be modified into an extension attribute directly. Again, it depends on how much data you need to capture, since a large file wouldn't work well as an EA.

sdagley
Esteemed Contributor II

@CAP Here's a quick & dirty script that will add a file as an attachment to a computer's record in the JSS (you probably don't want to use this for large files):

#!/bin/bash

# Upload file as an attachment to the computer record in the JSS

jssAddress=$4
jssAPIUsername=$5
jssAPIPassword=$6
computerName=$(/usr/sbin/scutil --get ComputerName)

curl -k -u ${jssAPIUsername}:${jssAPIPassword} ${jssAddress}/JSSResource/fileuploads/computers/name/${computerName} -F name=@/Path/To/File/To/Be/Uploaded.txt -X POST

bentoms
Release Candidate Programs Tester

A .command file is a bash script, so you should be able to amend to run direct via a jamf policy.