Adobe Reader Update

Yalem
New Contributor II

Newbie here, where do I find the actual Adobe Reader 11.0..09 update? When I try to download it on my test machine, it just automatically installs through Safari. I need to download so I can put it into Casper Admin. Thanks.

54 REPLIES 54

CasperSally
Valued Contributor II

Check out autopkg - great tool for getting updates. You can automate it or get them downloaded on demand (one or several updates from various vendors)

https://github.com/autopkg/autopkg/wiki/Getting-Started

Yalem
New Contributor II

Sounds cool. What will this do for me? I think I've heard of autopkg, but don't know what it is.

htse
Contributor III

you can get the traditional package at http://get.adobe.com/reader/ There's a link for Are You an IT Manager for OEM? to register.

CasperSally
Valued Contributor II

@Yalem - check the link for more info.

robinwang
New Contributor

http://get.adobe.com/reader/enterprise/
Google 'adobe reader offline installer'.

joe_farage
New Contributor III

Hi all,

Here is an Adobe Reader updater/installer script. No need to package anything! Find it here.
Enjoy 😉
joe

dferrara
Contributor II

@joe.farage, I was just getting to implementing your beautiful script but alas, Adobe has killed Reader and replaced it with Acrobat Reader DC. I tried repairing the script myself, but Adobe has changed the versioning scheme to match the other CC products. I would love to hear your thoughts.

joe_farage
New Contributor III

Hi @dferrara ! HI all !
I've updated the script to work with the new Adobe Acrobat Reader DC. Please you can test it and come back if you have problems.
Kind regards,
joe

#!/bin/sh
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
#   AdobeReaderUpdate.sh -- Installs or updates Adobe Acrobat Reader DC
#
# SYNOPSIS
#   sudo AdobeReaderUpdate.sh
#
####################################################################################################
#
# HISTORY
#
#   Version: 1.1
#
#   - v.1.0 Joe Farage, 23.01.2015
#   - v.1.1 Joe Farage, 08.04.2015 : support for new Adobe Acrobat Reader DC
#
####################################################################################################
# Script to download and install Adobe Reader.
# Only works on Intel systems.

dmgfile="reader.dmg"
logfile="/Library/Logs/AdobeReaderDCUpdateScript.log"

# Are we running on Intel?
if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then
    ## Get OS version and adjust for use with the URL string
    OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )

    ## Set the User Agent string for use with curl
    userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"

    # Get the latest version of Reader available from Adobe's About Reader page.
    latestver=``
    while [ -z "$latestver" ]
    do
       latestver=`/usr/bin/curl -s -L -A "$userAgent" https://get.adobe.com/reader/ | grep "<strong>Version" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $2}'`
    done

    echo "Latest Version is: $latestver"
    latestvernorm=`echo ${latestver} | sed -e 's/20//'`
    # Get the version number of the currently-installed Adobe Reader, if any.
    if [ -e "/Applications/Adobe Acrobat Reader DC.app" ]; then
        currentinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
        echo "Current installed version is: $currentinstalledver"
        if [ ${latestvernorm} = ${currentinstalledver} ]; then
            echo "Adobe Reader DC is current. Exiting"
            exit 0
        fi
    else
        currentinstalledver="none"
        echo "Adobe Reader DC is not installed"
    fi


    ARCurrVersNormalized=$( echo $latestver | sed -e 's/[.]//g' -e 's/20//' )
    echo "ARCurrVersNormalized: $ARCurrVersNormalized"
    url=""
    url1="http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/${ARCurrVersNormalized}/AcroRdrDC_${ARCurrVersNormalized}_MUI.dmg"
    url2=""

    #Build URL  
    url=`echo "${url1}${url2}"`
    echo "Latest version of the URL is: $url"


    # Compare the two versions, if they are different or Adobe Reader is not present then download and install the new version.
    if [ "${currentinstalledver}" != "${latestvernorm}" ]; then
        /bin/echo "`date`: Current Reader DC version: ${currentinstalledver}" >> ${logfile}
        /bin/echo "`date`: Available Reader DC version: ${latestver} => ${latestvernorm}" >> ${logfile}
        /bin/echo "`date`: Downloading newer version." >> ${logfile}
        /usr/bin/curl -s -o /tmp/reader.dmg ${url}
        /bin/echo "`date`: Mounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil attach /tmp/reader.dmg -nobrowse -quiet
        /bin/echo "`date`: Installing..." >> ${logfile}
        /usr/sbin/installer -pkg /Volumes/AcroRdrDC_${ARCurrVersNormalized}_MUI/AcroRdrDC_${ARCurrVersNormalized}_MUI.pkg -target / > /dev/null

        /bin/sleep 10
        /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep Adobe Acrobat Reader DC Installer | awk '{print $1}') -quiet
        /bin/sleep 10
        /bin/echo "`date`: Deleting disk image." >> ${logfile}
        /bin/rm /tmp/${dmgfile}

        #double check to see if the new version got updated
        newlyinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
        if [ "${latestvernorm}" = "${newlyinstalledver}" ]; then
            /bin/echo "`date`: SUCCESS: Adobe Reader has been updated to version ${newlyinstalledver}" >> ${logfile}
       # /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -title "Adobe Reader Updated" -description "Adobe Reader has been updated." &
        else
            /bin/echo "`date`: ERROR: Adobe Reader update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}
            /bin/echo "--" >> ${logfile}
            exit 1
        fi

    # If Adobe Reader is up to date already, just log it and exit.       
    else
        /bin/echo "`date`: Adobe Reader is already up to date, running ${currentinstalledver}." >> ${logfile}
        /bin/echo "--" >> ${logfile}
    fi  
else
    /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}
fi

exit 0

dferrara
Contributor II

@joe.farage Thanks Joe! I'll try it out!

jwojda
Valued Contributor II

can this be modified to look for an existing A. Reader and remove it by chance? Just so it doesn't confuse the users or does it overnight the old A.Reader (non-DC versions I mean)?

jwojda
Valued Contributor II

any updates on how this is working for people?

dferrara
Contributor II

@jwojda The whole Acrobat Reader thing is still messing me up -- who in their right mind thought that was a good name for this -- the script itself is awesome and I'm using it in our Yosemite image. I thought if people need the old Reader, they can get it from Self Service.

mm2270
Legendary Contributor II

Yeah, Adobe Acrobat Reader DC is just a gem of a name isn't it? 🙂 Just rolls off the tongue.

Anyway, Reader DC installs a new application, because, well, its a new application. So it won't overwrite the older Reader. You can have both installed at the same time, though I can't imagine any reason to do that. One of them is enough.
If you really want to have it remove the older application, that's certainly doable.

cbrewer
Valued Contributor II

Thanks for sharing your scripts @joe.farage

Dalmatian
Contributor

@joe.farage Hi Joe and all

any scripts for Adobe Reader?

pmcgurn
New Contributor III

Hi all,

I ran the DC version, and it seemed to block/lock while the install was happening. I'd get the latest URL echo, but then output in terminal would stop. I let it sit for a couple minutes, and then did a control+c. I ran it again, and it detected that it was installed! Just FYI.

Also, I'd recommend an option for this script to both remove the non-DC version, plus set/override the default system extension handler to use the DC version when a user tried to open a PDF.

Something like

rm -rf /applications/Adobe Reader.app
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType = "com.adobe.pdf"; LSHandlerRoleAll = "com.adobe.reader";}'

The default handler update not be needed, because the DC version uses the same identifier as the non-DC version, not sure if deleting an app will revert this to the Preview app or not.

ryan_s
New Contributor II

@joe.farage I've been using your script for some time and I just wanted to say its awesome! Recently however, I have seen some oddities...reference link from Adobe maybe changed? What do you think ...

Submitting log to https://jss.teslamotors.com:8443/
Executing Policy Adobe Acrobat Reader DC...
Running script Application_AdobeDC-UpdateReader...
Script exit code: 1
Script result: Latest Version is: 2015.009.20069
Current installed version is: 15.009.20077
ARCurrVersNormalized: 1500920069
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/1500920069/AcroRdrDC_1500920069_MUI.dmg

The user is actually running a newer version that the script is returning... As you can see above, the client is v2015.009.20077 and the newest version is v2015.009.20069

millersc
Valued Contributor

@ryan.s I also saw the same thing last week. I made a couple small tweaks to use with my EA:

# Script to download and install Adobe Reader.
# Only works on Intel systems.

dmgfile="AcroRdrDC_${ARCurrVersNormalized}_MUI.dmg"
logfile="/Library/Logs/AdobeReaderDCUpdateScript.log"

# Are we running on Intel?
if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then
    ## Get OS version and adjust for use with the URL string
    OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )

    ## Set the User Agent string for use with curl
    userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"

    # Get the latest version of Reader available from Adobe's About Reader page.
    latestver=``
    while [ -z "$latestver" ]
    do
       latestver=`/usr/bin/curl -s -L -A "$userAgent" https://get.adobe.com/reader/ | grep "<strong>Version" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $2}' | cut -c 3-14`
    done

    echo "Latest Version is: $latestver"
    latestvernorm=`echo ${latestver}`
    # Get the version number of the currently-installed Adobe Reader, if any.
    if [ -e "/Applications/Adobe Acrobat Reader DC.app" ]; then
        currentinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
        echo "Current installed version is: $currentinstalledver"
        if [ ${latestvernorm} = ${currentinstalledver} ]; then
            echo "Adobe Reader DC is current. Exiting"
            exit 0
        fi
    else
        currentinstalledver="none"
        echo "Adobe Reader DC is not installed"
    fi


    ARCurrVersNormalized=$( echo $latestver | sed -e 's/[.]//g' )
    echo "ARCurrVersNormalized: $ARCurrVersNormalized"
    url1="http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/${ARCurrVersNormalized}/AcroRdrDC_${ARCurrVersNormalized}_MUI.dmg"
    url2=""

    #Build URL  
    url=`echo "${url1}${url2}"`
    echo "Latest version of the URL is: $url"


    # Compare the two versions, if they are different or Adobe Reader is not present then download and install the new version.
    if [ "${currentinstalledver}" != "${latestvernorm}" ]; then
        /bin/echo "`date`: Current Reader DC version: ${currentinstalledver}" >> ${logfile}
        /bin/echo "`date`: Available Reader DC version: ${latestver} => ${latestvernorm}" >> ${logfile}
        /bin/echo "`date`: Downloading newer version." >> ${logfile}
        /usr/bin/curl -s -o /tmp/${dmgfile} ${url}
        /bin/echo "`date`: Mounting installer disk image." >> ${logfile}
        /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet
        /bin/echo "`date`: Installing..." >> ${logfile}
        /usr/sbin/installer -pkg /Volumes/AcroRdrDC_${ARCurrVersNormalized}_MUI/AcroRdrDC_${ARCurrVersNormalized}_MUI.pkg -target / > /dev/null

        /bin/sleep 10
        /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
        #/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep Adobe Acrobat Reader DC Installer | awk '{print $1}') -quiet
        /sbin/umount "/Volumes/AcroRdrDC_${ARCurrVersNormalized}_MUI"
        /bin/sleep 10
        /bin/echo "`date`: Deleting disk image." >> ${logfile}
        /bin/rm /tmp/${dmgfile}

        #double check to see if the new version got updated
        newlyinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
        if [ "${latestvernorm}" = "${newlyinstalledver}" ]; then
            /bin/echo "`date`: SUCCESS: Adobe Reader has been updated to version ${newlyinstalledver}" >> ${logfile}
       # /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -title "Adobe Reader Updated" -description "Adobe Reader has been updated." &
        else
            /bin/echo "`date`: ERROR: Adobe Reader update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}
            /bin/echo "--" >> ${logfile}
            exit 1
        fi

    # If Adobe Reader is up to date already, just log it and exit.       
    else
        /bin/echo "`date`: Adobe Reader is already up to date, running ${currentinstalledver}." >> ${logfile}
        /bin/echo "--" >> ${logfile}
    fi  
else
    /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}
fi

exit 0

ryan_s
New Contributor II

I must be dense... what were the changes made @millersc?

millersc
Valued Contributor

Sorry about that. I haven't had the chance to contribute yet to the original creator.

Changes to:
line 40: latestver - added a 'cut' to the end
line 44: removed 'sed' command
line 59: remove the second 'sed' command
line 63: removed (seems to work fine without it as line 66 is the same)
line 83: commented out, added additional line for 'umount' command (found it worked better)

These changes with EA looking at: defaults read "/Applications/Adobe Acrobat Reader DC.app/Contents/Info.plist" CFBundleVersion

Result in one of the following:

Script result: Latest Version is: 15.009.20069
Current installed version is: 15.009.20069
Adobe Reader DC is current. Exiting

or

Script result: Latest Version is: 15.009.20069
Adobe Reader DC is not installed
ARCurrVersNormalized: 1500920069
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/1500920069/AcroRdrDC_1500920069_MUI.dmg

ryan_s
New Contributor II

I wish there was a like button... thanks @millersc that has done the trick!

joe_farage
New Contributor III

Hi @ryan.s @millersc !!
thanks for the changes but for me it will not work if I have v.15.009.20077 installed. there is something strange at adobe with versions. 15.009.20077 is older than 15.009.20069!!

millersc
Valued Contributor

That is strange @joe.farage . I'm not sure there is any work around for Adobe screw ups. I can only assume they released '77 and then pulled it for some reason. Is your whole fleet running '77?

Always happy to contribute!

mm2270
Legendary Contributor II

Just want to chime in to say I have seen the same issue with one of my own scripts that updates ReaderDC. The current version posted from Adobe seems to be .20069, but I have .20077 installed on my Mac. I'm pretty sure Adobe's built in update system prompted me to install .20077, so I don't know what's going on with that.
This is unfortunately, one of the main issues I've run into with the scripts I have that auto pull down updated applications. If the vendor is lazy/stupid/incompetent, and messes up the latest version info being posted, or it doesn't match what actually gets pulled down, these kinds of scripts just break. We're at the mercy of the developers to spend 2 minutes to update a site that they just don't seem to have the time to do. Incredibly annoying.

I suspect in this case, Adobe simply hasn't updated the https://get.adobe.com/reader/ site to reflect that .20077 is in fact the latest version.

C_Long
New Contributor II

Let me start by saying thank you to @joe.farage, creator of this script, and to @millersc for his tweaks.

The script has been working great on the majority our machines in my school district. I have run into some that Fail to run the script successfully though. I am getting the following error:

Script result: Latest Version is: 15.010.20060 Adobe Reader DC is not installed ARCurrVersNormalized: 1501020060 Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/1501020060/AcroRdrDC_1501020060_MUI.dmg 2016-04-05 15:11:59.144 defaults[18052:727655] The domain/default pair of (/Applications/Adobe Acrobat Reader DC.app/Contents/Info, CFBundleShortVersionString) does not exist Error running script: return code was 1.

It seems that the Adobe Reader.app is currently running on these machines at the time the policy is triggered. I am not a script writer; but how would you go about adding something in the script to first check for and close the app, and then continue with the rest of the script?

Any assistance would be appreciated. I have been going machine to machine using ARD to manually close Adobe Reader. Then I run a UNIX command from within ARD to force the JAMF policy to rerun the script successfully.

millersc
Valued Contributor

@C.Long I see where your going. I'll put it on my to-do list. But the way I see it is:
Check to see if Reader DC is running
If not, start script.
If yes, pop up a box. Button 1(continue) quits Reader DC or button 2 (exit) quits script.

I'll have to think about putting some time delay in it or looping it. Let me know if you have other thoughts.

C_Long
New Contributor II

@millersc, thank you for taking the time to help me out. I think they way you've described it would be a good idea. That is if I am following your correctly. I am assuming the 2 buttons are for the user to choose between. So not to kick them out of anything important they maybe working on. Also, I just wanted to mention that in my case, it wasn't Reader DC that was running. It was good old Adobe Reader 11 that is causing the issue.

PhillyPhoto
Contributor III

377b02286cb541d4bb92d801c5034c4a
I've taken the work @joe.farage and @millersc have done and sort of ran with it. I updated the script to update both Reader and Reader DC to the latest Reader DC version. I also add an alternate download in case the client can't download the full installer. The attached photo shows what it looks like in the policy logs when it runs successfully (I have since changed the exit codes, so it should show 0 instead of 1 now). I have the JAMF RECON command if it's successful because I have it scoped to only run on machines that aren't current, and I want to make sure it falls out of scope ASAP when it's updated.

#!/bin/bash

#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
#   AdobeReaderUpdate.sh -- Installs or updates Adobe Reader
#
# SYNOPSIS
#   sudo AdobeReaderUpdate.sh
#
# EXIT CODES
#   0 - Adobe Reader DC installed successfully
#   1 - Adobe Reader DC is current
#   2 - Adobe Reader DC NOT installed
#   3 - Adobe Reader DC update unsuccessful
#   4 - Adobe Reader (DC) is running or was attempted to be installed manually and user deferred install
#   5 - Not an Intel-based Mac
#
####################################################################################################
#
# HISTORY
#   Based on the threads:
#   https://jamfnation.jamfsoftware.com/viewProductFile.html?id=42&fid=761
#   https://jamfnation.jamfsoftware.com/discussion.html?id=12042
#   Version: 1.4
#
#   - v.1.0 Joe Farage, 23.01.2015
#   - v.1.1 Joe Farage, 08.04.2015 : support for new Adobe Acrobat Reader DC
#   - v.1.2 Steve Miller, 15.12.2015
#   - v.1.3 Luis Lugo, 07.04.2016 : updates both Reader and Reader DC to the latest Reader DC
#   - v.1.4 Luis Lugo, 28.04.2016 : attempts an alternate download if the first one fails
#
####################################################################################################
# Script to download and install Adobe Reader DC.
# Only works on Intel systems.

# Setting variables
readerProcRunning=0

# Echo function
echoFunc () {
    # Date and Time function for the log file
    fDateTime () { echo $(date +"%a %b %d %T"); }

    # Title for beginning of line in log file
    Title="InstallLatestAdobeReader:"

    # Header string function
    fHeader () { echo $(fDateTime) $(hostname) $Title; }

    # Check for the log file
    if [ -e "/Library/Logs/AdobeReaderDCUpdateScript.log" ]; then
        echo $(fHeader) "$1" >> "/Library/Logs/AdobeReaderDCUpdateScript.log"
    else
        cat > "/Library/Logs/AdobeReaderDCUpdateScript.log"
        if [ -e "/Library/Logs/AdobeReaderDCUpdateScript.log" ]; then
            echo $(fHeader) "$1" >> "/Library/Logs/AdobeReaderDCUpdateScript.log"
        else
            echo "Failed to create log file, writing to JAMF log"
            echo $(fHeader) "$1" >> "/var/log/jamf.log"
        fi
    fi

    # Echo out
    echo $(fDateTime) ": $1"
}

# Exit function
exitFunc () {
    case $1 in
        0) exitCode="0 - SUCCESS: Adobe Reader has been updated to version $2";;
        1) exitCode="1 - INFO: Adobe Reader DC is current! Version: $2";;
        2) exitCode="2 - INFO: Adobe Reader DC NOT installed!";;
        3) exitCode="3 - ERROR: Adobe Reader DC update unsuccessful, version remains at  $2!";;
        4) exitCode="4 - ERROR: Adobe Reader (DC) is running or was attempted to be installed manually and user deferred install.";;
        5) exitCode="5 - ERROR: Not an Intel-based Mac.";;
        *) exitCode="$1";;
    esac
    echoFunc "Exit code: $exitCode"
    echoFunc "======================== Script Complete ========================"
    exit $1
}

# Check to see if Reader or Reader DC is running
readerRunningCheck () {
    processNum=$(ps aux | grep "Adobe Acrobat Reader DC" | wc -l)
    if [ $processNum -gt 1 ]
    then
        # Reader is running, prompt the user to close it or defer the upgrade
        readerRunning
    else
        # Check if the older Adobe Reader is running
        processNum=$(ps aux | grep "Adobe Reader" | wc -l)
        if [ $processNum -gt 1 ]
        then
            # Reader is running, prompt the user to close it or defer the upgrade
            readerRunning
        else
            # Adobe Reader shouldn't be running, continue on
            echoFunc "Adobe Acrobat Reader (DC) doesn't appear to be running!"
        fi
    fi
}

# If Adobe Reader is running, prompt the user to close it
readerRunning () {
    echoFunc "Adobe Acrobat Reader (DC) appears to be running!"
    hudTitle="Adobe Acrobat Reader DC Update"
    hudDescription="Adobe Acrobat Reader needs to be updated. Please save your work and close the application to proceed. You can defer if needed.
If you have any questions, please call the help desk."

    jamfHelperPrompt=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -title "$hudTitle" -description "$hudDescription" -button1 "Proceed" -button2 "Defer" -defaultButton 1`

    case $jamfHelperPrompt in
        0)
            echoFunc "Proceed selected"
            readerProcRunning=1
            readerRunningCheck
        ;;
        2)
            echoFunc "Deferment Selected"
            exitFunc 4
        ;;
        *)
            echoFunc "Selection: $?"
            exitFunc 3 "Unknown"
        ;;
    esac
}

# Let the user know we're installing Adobe Acrobat Reader DC manually
readerUpdateMan () {
    echoFunc "Letting the user know we're installing Adobe Acrobat Reader DC manually!"
    hudTitle="Adobe Acrobat Reader DC Update"
    hudDescription="Adobe Acrobat Reader needs to be updated. You will see a program downloading the installer. You can defer if needed.
If you have any questions, please call the help desk."

    jamfHelperPrompt=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -title "$hudTitle" -description "$hudDescription" -button1 "Defer" -button2 "Proceed" -defaultButton 1 -timeout 60 -countdown`

    case $jamfHelperPrompt in
        0)
            echoFunc "Deferment Selected or Window Timed Out"
            exitFunc 4
        ;;
        2)
            echoFunc "Proceed selected"
            readerRunningCheck
        ;;
        *)
            echoFunc "Selection: $?"
            exitFunc 3 "Unknown"
        ;;
    esac
}

echoFunc ""
echoFunc "======================== Starting Script ========================"

# Are we running on Intel?
if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then
    ## Get OS version and adjust for use with the URL string
    OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )

    ## Set the User Agent string for use with curl
    userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"

    # Get the latest version of Reader available from Adobe's About Reader page.
    latestver=``
    while [ -z "$latestver" ]
    do
        latestver=`curl -s -L -A "$userAgent" https://get.adobe.com/reader/ | grep "<strong>Version" | /usr/bin/sed -e 's/<[^>][^>]*>//g' | /usr/bin/awk '{print $2}' | cut -c 3-14`
    done

    echoFunc "Latest Adobe Reader DC Version is: $latestver"
    latestvernorm=`echo ${latestver}`
    # Get the version number of the currently-installed Adobe Reader, if any.
    if [ -e "/Applications/Adobe Acrobat Reader DC.app" ]; then
        currentinstalledapp="Reader DC"
        currentinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
        echoFunc "Current Reader DC installed version is: $currentinstalledver"
        if [ ${latestvernorm} = ${currentinstalledver} ]; then
            exitFunc 1 "${currentinstalledapp} ${currentinstalledver}"
        else
            # Not running the latest DC version, check if Reader is running
            readerRunningCheck
        fi
    elif [ -e "/Applications/Adobe Reader.app" ]; then
        currentinstalledapp="Reader"
        currentinstalledver=`/usr/bin/defaults read /Applications/Adobe Reader.app/Contents/Info CFBundleShortVersionString`
        echoFunc "Current Reader installed version is: $currentinstalledver"
        processNum=$(ps aux | grep "Adobe Reader" | wc -l)
        if [ $processNum -gt 1 ]
        then
            readerRunning
        else
            echoFunc "Adobe Reader doesn't appear to be running!"
        fi
    else
        currentinstalledapp="None"
        currentinstalledver="N/A"
        exitFunc 2
    fi

    # Build URL and dmg file name
    ARCurrVersNormalized=$( echo $latestver | sed -e 's/[.]//g' )
    echoFunc "ARCurrVersNormalized: $ARCurrVersNormalized"
    url1="http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/${ARCurrVersNormalized}/AcroRdrDC_${ARCurrVersNormalized}_MUI.dmg"
    url2=""
    url=`echo "${url1}${url2}"`
    echoFunc "Latest version of the URL is: $url"
    dmgfile="AcroRdrDC_${ARCurrVersNormalized}_MUI.dmg"

    # Compare the two versions, if they are different or Adobe Reader is not present then download and install the new version.
    if [ "${currentinstalledver}" != "${latestvernorm}" ]; then
        echoFunc "Current Reader DC version: ${currentinstalledapp} ${currentinstalledver}"
        echoFunc "Available Reader DC version: ${latestver} => ${ARCurrVersNormalized}"
        echoFunc "Downloading newer version."
        curl -s -o /tmp/${dmgfile} ${url}
        case $? in
            0)
                echoFunc "Checking if the file exists after downloading."
                if [ -e "/tmp/${dmgfile}" ]; then
                    readerFileSize=$(du -k "/tmp/${dmgfile}" | cut -f 1)
                    echoFunc "Downloaded File Size: $readerFileSize kb"
                else
                    echoFunc "File NOT downloaded!"
                    exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                fi
                echoFunc "Checking if Reader is running one last time before we install"
                readerRunningCheck
                echoFunc "Mounting installer disk image."
                hdiutil attach /tmp/${dmgfile} -nobrowse -quiet
                echoFunc "Installing..."
                installer -pkg /Volumes/AcroRdrDC_${ARCurrVersNormalized}_MUI/AcroRdrDC_${ARCurrVersNormalized}_MUI.pkg -target / > /dev/null

                sleep 10
                echoFunc "Unmounting installer disk image."
                umount "/Volumes/AcroRdrDC_${ARCurrVersNormalized}_MUI"
                sleep 10
                echoFunc "Deleting disk image."
                rm /tmp/${dmgfile}

                # double check to see if the new version got updated
                if [ -e "/Applications/Adobe Acrobat Reader DC.app" ]; then
                    newlyinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
                    if [ "${latestvernorm}" = "${newlyinstalledver}" ]; then
                        echoFunc "SUCCESS: Adobe Reader has been updated to version ${newlyinstalledver}, issuing JAMF recon command"
                        jamf recon
                        if [ $readerProcRunning -eq 1 ];
                        then
                            /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -title "Adobe Reader DC Updated" -description "Adobe Reader DC has been updated to version ${newlyinstalledver}." -button1 "OK" -defaultButton 1
                        fi
                        exitFunc 1 "${newlyinstalledver}"
                    else
                        exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                    fi
                else
                    exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                fi
            ;;
            *)
                echoFunc "Curl function failed on primary download! Error: $?. Review error codes here: https://curl.haxx.se/libcurl/c/libcurl-errors.html"
                echoFunc "Attempting alternate download from https://admdownload.adobe.com/bin/live/AdobeReader_dc_en_a_install.dmg"
                curl -s -o /tmp/AdobeReader_dc_en_a_install.dmg https://admdownload.adobe.com/bin/live/AdobeReader_dc_en_a_install.dmg
                case $? in
                    0)
                        echoFunc "Checking if the file exists after downloading."
                        if [ -e "/tmp/AdobeReader_dc_en_a_install.dmg" ]; then
                            readerFileSize=$(du -k "/tmp/AdobeReader_dc_en_a_install.dmg" | cut -f 1)
                            echoFunc "Downloaded File Size: $readerFileSize kb"
                        else
                            echoFunc "File NOT downloaded!"
                            exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                        fi
                        echoFunc "Checking if Reader is running one last time before we install"
                        readerRunningCheck
                        echoFunc "Checking with the user if we should proceed"
                        readerUpdateMan
                        echoFunc "Mounting installer disk image."
                        hdiutil attach /tmp/AdobeReader_dc_en_a_install.dmg -nobrowse -quiet
                        echoFunc "Installing..."
                        /Volumes/Adobe Acrobat Reader DC Installer/Install Adobe Acrobat Reader DC.app/Contents/MacOS/Install Adobe Acrobat Reader DC
                        sleep 10
                        echoFunc "Unmounting installer disk image."
                        umount "/Volumes/Adobe Acrobat Reader DC Installer"
                        sleep 10
                        echoFunc "Deleting disk image."
                        rm /tmp/AdobeReader_dc_en_a_install.dmg

                        # double check to see if the new version got updated
                        if [ -e "/Applications/Adobe Acrobat Reader DC.app" ]; then
                            newlyinstalledver=`/usr/bin/defaults read /Applications/Adobe Acrobat Reader DC.app/Contents/Info CFBundleShortVersionString`
                            if [ "${latestvernorm}" = "${newlyinstalledver}" ]; then
                                echoFunc "SUCCESS: Adobe Reader has been updated to version ${newlyinstalledver}, issuing JAMF recon command"
                                jamf recon
                                exitFunc 0 "${newlyinstalledver}"
                            else
                                exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                            fi
                        else
                            exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                        fi
                    ;;
                    *)
                        echoFunc "Curl function failed on alternate download! Error: $?. Review error codes here: https://curl.haxx.se/libcurl/c/libcurl-errors.html"
                        exitFunc 3 "${currentinstalledapp} ${currentinstalledver}"
                    ;;
                esac
            ;;
        esac
    else
        # If Adobe Reader DC is up to date already, just log it and exit.
        exitFunc 1 "${currentinstalledapp} ${currentinstalledver}"
    fi
else
    # This script is for Intel Macs only.
    exitFunc 5
fi

C_Long
New Contributor II

This is awesome. These could really be the answer I have been seeking to all these teacher that never logout or restart their machines. I think I'll give it a test run here in our environment. Thanks so much.

millersc
Valued Contributor

@PhillyPhoto Way to go! I do like the logging you built in! So far testing is working well.

PhillyPhoto
Contributor III

I had a user that I was working with that wasn't getting the download with the first or second URL. It turns out, when he went home it worked. I then realized that some users might be connecting to our in-office WiFi network that only allows internal connections (Citrix gateways, etc) and that's why it was failing. I added the following code to my script and wanted to put it out in case anyone else using this has users on a similar wireless network.

You'll be able to use a passed variable (i.e. $4) for the badSSIDs array with space delimiters, just make sure to escape any spaces in SSID names with a "".

# Are we on a bad wireless network?
if [[ "$4" != "" ]]
then
    wifiSSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I |     awk '/ SSID/ {print substr($0, index($0, $2))}'`
    echoFunc "Current Wireless SSID: $wifiSSID"

    badSSIDs=( $4 )
    for (( i = 0; i < "${#badSSIDs[@]}"; i++ ))
    do
        if [[ "$wifiSSID" == "${badSSIDs[i]}" ]]
        then
            echoFunc "Connected to a WiFi network that blocks downloads!"
            exitFunc 6 "${badSSIDs[i]}"
        fi
    done
fi

I added this right above the Intel check, and added a 6th case check in the exit function to state that it was connected to a bad SSID:

6) exitCode="6 - ERROR: Wireless connected to a known bad WiFi network that won't allow downloading of the installer! SSID: $2";;

tkimpton
Valued Contributor II

@joe.farage unfortunately the Adobe Reader script found here my link text no longer works and results in error

Latest Version is: 
Adobe Reader is not installed
Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/.x//en_US/AdbeRdr_en_US.dmg
2016-06-03 10:36:04.611 defaults[28860:4321864] 
The domain/default pair of (/Applications/Adobe Reader.app/Contents/Info, CFBundleShortVersionString) does not exist

any idea on getting the normal Reader working?

bbot
Contributor

Which part of that script removes the Adobe Reader.app and replaces it with the Adobe Reader DC app? @PhillyPhoto

PhillyPhoto
Contributor III

@bbot - It's part of the Reader DC installer package.

bbot
Contributor

@PhillyPhoto Awesome, thanks for posting!

Everything is working great. I did find in some cases with users running 10.9.5. Not a huge deal as we're moving away from 10.9.5 at the moment.

Script result: Wed Jun 22 10:50:20 :
Wed Jun 22 10:50:20 : ======================== Starting Script ========================
Wed Jun 22 10:50:21 : Latest Adobe Reader DC Version is: 15.016.20039
Wed Jun 22 10:50:21 : Current Reader installed version is: 11.0.15
Wed Jun 22 10:50:21 : Adobe Acrobat Reader (DC) appears to be running!
Wed Jun 22 10:50:21 : Selection: 0
Wed Jun 22 10:50:21 : Exit code: 3 - ERROR: Adobe Reader DC update unsuccessful, version remains at Unknown!
Wed Jun 22 10:50:21 : ======================== Script Complete ========================

kerouak
Valued Contributor

why not just do this.....

https://helpx.adobe.com/creative-cloud/packager/update-server-setup-tool.html

it just works!!

Gluck!

luke_jaeger
New Contributor III

Anyone know where Reader DC stores its license info? I'd like to deploy it such that users won't have to accept the EULA on launch. I tried capturing it with Composer but it didn't work.

chuck3000
Contributor

@joe.farage , @millersc and @PhillyPhoto

Running the latest tweaked version as well as the fixed version Joe posted, thank you all, and thank you for the logging! I see there's still nothing in the script to catch the possibility that Adobe screwed up or downgraded their release. I'm not sure there' s a single good way to handle that, but what Im seeing is that the assumption the the online version is different, is therefore considered newer during the compare, downloads, tries to install, but the app installer fails.

If you run it through the GUI, you get this message
a50f94df1c974072ad8bcc25ad8e9e89

I'm not a great scripter but Perhaps somebody could consider modifying the script so that if it's newer, it logs the message and leaves the newer installed. If it's older, it downloads the newer and updates and if it's the same, it just leaves it alone. Perhaps a popup could be built in to offer the end-user the choice to accept or defer/deny the change?

Since I run the script in the background in Casper, my users wouldn't see the message. But if it's run in Self Service, they see a Policy Failed message and no reason displayed to them, can be annoying.

I'd also like to see the echo's to the log and not just stdout.

these are not criticism, but some feedback based on my experience and could help us to better our product to those we support.

Thanks!

Fri Nov 18 15:18:47 : ======================== Starting Script ========================
Fri Nov 18 15:18:49 : Latest Adobe Reader DC Version is: 15.020.20039
Fri Nov 18 15:18:49 : Current Reader DC installed version is: 15.020.20042
Fri Nov 18 15:18:49 : Adobe Acrobat Reader (DC) doesn't appear to be running!
Fri Nov 18 15:18:49 : ARCurrVersNormalized: 1502020039
Fri Nov 18 15:18:49 : Latest version of the URL is: http://ardownload.adobe.com/pub/adobe/reader/mac/AcrobatDC/1502020039/AcroRdrDC_1502020039_MUI.dmg
Fri Nov 18 15:18:49 : Current Reader DC version: Reader DC 15.020.20042
Fri Nov 18 15:18:49 : Available Reader DC version: 15.020.20039 => 1502020039
Fri Nov 18 15:18:49 : Downloading newer version.
Fri Nov 18 15:19:15 : Checking if the file exists after downloading.
Fri Nov 18 15:19:15 : Downloaded File Size: 151020 kb
Fri Nov 18 15:19:15 : Checking if Reader is running one last time before we install
Fri Nov 18 15:19:15 : Adobe Acrobat Reader (DC) doesn't appear to be running!
Fri Nov 18 15:19:15 : Mounting installer disk image.
Fri Nov 18 15:19:19 : Installing...
Fri Nov 18 15:19:35 : Unmounting installer disk image.
Fri Nov 18 15:19:45 : Deleting disk image.
Fri Nov 18 15:19:45 : Exit code: 3 - ERROR: Adobe Reader DC update unsuccessful, version remains at Reader DC 15.020.20042!
Fri Nov 18 15:19:45 : ======================== Script Complete ========================

millersc
Valued Contributor

@chuck3000 Sorry no one has updated this thread.... darn turkey coma!

Update line 183 to the following:

if [ "${latestvernorm} -le ${currentinstalledver}" ]; then

You should be able to test and see the following result:

Wed Dec 14 13:08:41 : 
Wed Dec 14 13:08:41 : ======================== Starting Script ========================
Wed Dec 14 13:08:42 : Latest Adobe Reader DC Version is: 15.020.20039
Wed Dec 14 13:08:42 : Current Reader DC installed version is: 15.020.20042
Wed Dec 14 13:08:42 : Exit code: 1 - INFO: Adobe Reader DC is current! Version: Reader DC 15.020.20042
Wed Dec 14 13:08:42 : ======================== Script Complete ========================

This should help with Adobe pulling updates, after the script has run. Also, what is the frequency you have your policy running for this?

Stand by.... seeing issues with Philly's script and the exit codes. Will update shortly.