Friday, December 12, 2014

Adobe Flash Update is a f*cking joke!

I had this bright idea that I would blog some of my accomplishments.  At least the ones that might be helpful to other people.  That was like 10 years ago.  Woops.

Remember when Flash Player was a Macromedia product?  I miss those days.  Adobe needs to pull their developers head from their respective asses and figure out how to make a product updater that actually works.  If all of your users are local administrators (are you stupid?) and you don't use a proxy server with active directory authentication (must be nice), and you trust your users to allow the update to run when asked (all too often) then you must represent their imaginary customer.

For the rest of you like myself, I had to write a horrific batch script to accomplish some simple tasks.

  • Is there a new version that we need to install?
  • If so - remove all the old stuff.
  • Install the new stuff.
I like to install both the ActiveX *AND* the plugin.  You don't need the plugin if you only run IE in your environment.  But we are encountering a lot of applications written for Mozilla code (read Firefox).  Might as well have it there if we need it.

Go download the files.  To get your hands on the MSI installers, you will need to sign a distribution agreement.  So I can't give you those files.  Or even a link to them.  While Adobe has no time to cater to the needs of their customers, they seem to have plenty of time tracking down and yelling at people like me.

Put your files out in some common place.  Like the NETLOGON folder in your AD environment.  Or a file share somewhere.

But enough of that - here is the script.  Note, you might want to uncomment the pause at the bottom of this script so that you can do some debugging with it.


@ECHO OFF
REM Update Adobe Flash Player
REM Steve Ballantyne 12/12/2014

SET LATESTVERSION=16.0.0.235

REM Make sure our Temp folder exists.
IF NOT EXIST c:\Temp MKDIR c:\Temp

REM Check the LOGONSERVER variable - sometimes Windows is STOOPIDS
IF [%LOGONSERVER%] == [] (set LOGONSERVER=\\SOMEDOMAINCONTOLLER)

REM We must get rid of old versions of Flash
IF EXIST c:\Windows\System32\Macromed\Flash\FlashUtil*ActiveX.exe (set SYSTYPE=System32)
IF EXIST c:\Windows\SysWOW64\Macromed\Flash\FlashUtil*ActiveX.exe (set SYSTYPE=SysWOW64)

DIR /B c:\Windows\%SYSTYPE%\Macromed\Flash\FlashUtil*ActiveX.exe > c:\Temp\flashuninst.txt
set /P FLASHUNINST= < C:\Temp\flashuninst.txt

REM Do a version check against INSTALLED version (eg FlashUtil32_15_0_0_246_ActiveX.exe)
for /F "tokens=2 delims=_" %%a in ("%FLASHUNINST%") do SET MAJORV=%%a
for /F "tokens=3 delims=_" %%a in ("%FLASHUNINST%") do SET MINORV1=%%a
for /F "tokens=4 delims=_" %%a in ("%FLASHUNINST%") do SET MINORV2=%%a
for /F "tokens=5 delims=_" %%a in ("%FLASHUNINST%") do SET MINORV3=%%a
echo INSTALLED VERSION IS %MAJORV% %MINORV1% %MINORV2% %MINORV3%

REM Chop up version number of the LATEST FlashPlayer (variable set at the top of this file)
for /F "tokens=1 delims=." %%b in ("%LATESTVERSION%") do SET IMAJORV=%%b
for /F "tokens=2 delims=." %%b in ("%LATESTVERSION%") do SET IMINORV1=%%b
for /F "tokens=3 delims=." %%b in ("%LATESTVERSION%") do SET IMINORV2=%%b
for /F "tokens=4 delims=." %%b in ("%LATESTVERSION%") do SET IMINORV3=%%b
echo LATEST VERSION IS %IMAJORV% %IMINORV1% %IMINORV2% %IMINORV3%

REM Compare MAJOR version first (if it's the same or lower we keep on truckin)
IF %IMAJORV% GTR %MAJORV% goto UPDATE
REM Compare Minor versions next
IF %IMAJORV% EQU %MAJORV% goto CHECKMINOR1

:CHECKMINOR1
IF %IMINORV1% GEQ %MINORV1% (goto UPDATE) ELSE (goto CHECKMINOR2)

:CHECKMINOR2
IF %IMINORV2% GEQ %MINORV2% (goto UPDATE) ELSE (goto CHECKMINOR3)

:CHECKMINOR3
IF %IMINORV3% GTR %MINORV3% (goto UPDATE) ELSE (goto CHECKMINOR3b)

:CHECKMINOR3b
IF %IMINORV3% EQU %MINORV3% (goto DONE) ELSE (goto FAIL)

:FAIL
echo.
echo Something is wrong ...
echo Maybe the installed is newer than 
echo the one we are installing?
echo.
echo %computername% (%USERNAME%) FAILED to install Flash Player - Installed version %MAJORV%.%MINORV1%.%MINORV2%.%MINORV3% and the latest version %LATESTVERSION% on %DATE% at %TIME% >> \\SOMEWHERE\FlashInstallLog.txt
echo.

goto DONE

:UPDATE
ECHO c:\Windows\%SYSTYPE%\Macromed\Flash\%FLASHUNINST% -uninstall
REM Install ...
msiexec /i %LOGONSERVER%\NETLOGON\flashplayer\install_flash_player_%IMAJORV%_plugin.msi /quiet
msiexec /i %LOGONSERVER%\NETLOGON\flashplayer\install_flash_player_%IMAJORV%_active_x.msi /quiet
REM Leave a breadcrumbs file
date /t > c:\Windows\%SYSTYPE%\Macromed\Flash\DA-FlashPlayer-Installed-%LATESTVERSION%.txt && time /t >> c:\Windows\%SYSTYPE%\Macromed\Flash\DA-FlashPlayer-Installed-%LATESTVERSION%.txt
REM Cleanup
DEL c:\Temp\flashuninst.txt
echo %computername% (%USERNAME%) succeeded in installing Flash Player - Installed version was %MAJORV%.%MINORV1%.%MINORV2%.%MINORV3% updated to %LATESTVERSION% on %DATE% at %TIME% >> \\SOMEWHERE\FlashInstallLog.txt
GOTO DONE

:DONE
REM Goodbye!
REM pause