Skip to main content
Solved

Patch Reporting & Scripting


Forum|alt.badge.img+6
  • Contributor
  • 13 replies

Is there a way of passing the "Latest Version" variable from Patch Reporting of an application into a script in a policy?

 

Thanks

Best answer by mm2270

davec wrote:

Thanks. 

I was thinking of a Self Service option to download (curl) app installers/dmgs where the file name has the version number on it.  It would be easy if I could just pass the variable into the script's parameter. 


Ok, I was mistaken. The URL is still active. It's just that they seem to still have a lot of older titles in it that show up way at the top with some old last modification dates, like going back to 2020. But searching through the output, I can see the latest version of Google Chrome in there, as an example.

 

 

 

{ "name": "Google Chrome", "publisher": "Google", "lastModified": "2023-10-11T06:43:20Z", "currentVersion": "118.0.5993.70", "id": "0BC" },

 

 

 

That's just from 2 days ago, so it's current.

The URL is https://jamf-patch.jamfcloud.com/v1/software

Here's an example of how I might pull the latest version of Chrome. Back in the day I might have used a call to pass the output into python to get the specific information, but with python being removed from the macOS, it doesn't make much sense to use that anymore.

 

 

 

curl -s https://jamf-patch.jamfcloud.com/v1/software | grep -A4 "Google Chrome" | awk -F'"' '/currentVersion/{print $4}'

 

View original
Did this topic help you find an answer to your question?

5 replies

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • 2710 replies
  • October 13, 2023

Unfortunately no. However, you can make an extension attribute and a smart group to work with a policy in the same way patch management works.


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 13 replies
  • October 13, 2023
AJPinto wrote:

Unfortunately no. However, you can make an extension attribute and a smart group to work with a policy in the same way patch management works.


Thanks. 

I was thinking of a Self Service option to download (curl) app installers/dmgs where the file name has the version number on it.  It would be easy if I could just pass the variable into the script's parameter. 


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • October 13, 2023
davec wrote:

Thanks. 

I was thinking of a Self Service option to download (curl) app installers/dmgs where the file name has the version number on it.  It would be easy if I could just pass the variable into the script's parameter. 


At one time there was a public URL that Jamf maintained that had all their patch titles and details (like latest version, etc) in a JSON format. That could be curl'd in a script to grab the information you're looking for. Sadly, it looks like Jamf moved on some time ago to a different method. That URL still exists, but based on the last modification dates I see in it, they haven't been touched in several years now.

You could reach out to Jamf to see if there is some new URL they are using for this now that can be accessed. I have a feeling it's now protected for security reasons and no longer readable in a regular script though.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • October 13, 2023
davec wrote:

Thanks. 

I was thinking of a Self Service option to download (curl) app installers/dmgs where the file name has the version number on it.  It would be easy if I could just pass the variable into the script's parameter. 


Ok, I was mistaken. The URL is still active. It's just that they seem to still have a lot of older titles in it that show up way at the top with some old last modification dates, like going back to 2020. But searching through the output, I can see the latest version of Google Chrome in there, as an example.

 

 

 

{ "name": "Google Chrome", "publisher": "Google", "lastModified": "2023-10-11T06:43:20Z", "currentVersion": "118.0.5993.70", "id": "0BC" },

 

 

 

That's just from 2 days ago, so it's current.

The URL is https://jamf-patch.jamfcloud.com/v1/software

Here's an example of how I might pull the latest version of Chrome. Back in the day I might have used a call to pass the output into python to get the specific information, but with python being removed from the macOS, it doesn't make much sense to use that anymore.

 

 

 

curl -s https://jamf-patch.jamfcloud.com/v1/software | grep -A4 "Google Chrome" | awk -F'"' '/currentVersion/{print $4}'

 


Forum|alt.badge.img+6
  • Author
  • Contributor
  • 13 replies
  • October 14, 2023
mm2270 wrote:

Ok, I was mistaken. The URL is still active. It's just that they seem to still have a lot of older titles in it that show up way at the top with some old last modification dates, like going back to 2020. But searching through the output, I can see the latest version of Google Chrome in there, as an example.

 

 

 

{ "name": "Google Chrome", "publisher": "Google", "lastModified": "2023-10-11T06:43:20Z", "currentVersion": "118.0.5993.70", "id": "0BC" },

 

 

 

That's just from 2 days ago, so it's current.

The URL is https://jamf-patch.jamfcloud.com/v1/software

Here's an example of how I might pull the latest version of Chrome. Back in the day I might have used a call to pass the output into python to get the specific information, but with python being removed from the macOS, it doesn't make much sense to use that anymore.

 

 

 

curl -s https://jamf-patch.jamfcloud.com/v1/software | grep -A4 "Google Chrome" | awk -F'"' '/currentVersion/{print $4}'

 


Thanks!  This will certainly make my life easier.  The weird thing is when I go to the site and do a find (command-f) for one of the apps, say "Google Chrome" it won't find it but does find it when running the curl command.  Same with a few others I had tried like Figma and Audacity.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings