Last active
December 12, 2021 05:52
-
-
Save LewisLebentz/b819019a2c4dbde7dbdbecc8f78f39b3 to your computer and use it in GitHub Desktop.
Python script to get the latest version number of Chrome from Google and compare it to the version of Chrome installed on the local Mac. Then updates an Extension Attribute in Jamf Pro with either 'Latest' or 'Old'.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import urllib2 | |
import os.path | |
import plistlib | |
url = 'http://omahaproxy.appspot.com/all.json' | |
resp = urllib2.urlopen(url) | |
data = json.loads(resp.read()) | |
for each in data: | |
if each.get("os") == "mac": | |
versions = each.get("versions") | |
for version in versions: | |
if version.get("channel") == "stable": | |
latest = (version.get("current_version")) | |
print latest | |
print os.path.exists("/Applications/Google Chrome.app") | |
plistloc = "/Applications/Google Chrome.app/Contents/Info.plist" | |
pl = plistlib.readPlist(plistloc) | |
pver = pl["CFBundleShortVersionString"] | |
print pver | |
if latest == pver: | |
print "<result>Latest</result>" | |
else: | |
print "<result>Old</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment