CMD

Java Silent Update Part 4 – The Deployment with Script

Last week, I described how to deploy Java via Group Policy.  When this isn’t an option, you will be turning to a deployment program / service or scripting.  In this point, I will go into details on how to script this deployment from a location that is accessible on your network.  Please take this advice and make it your own and fit it to your design needs.

After deciding what works best for you environment, you will be able to put everything together. We created a filed called INSTALL.CMD and used this for the task. We then combined the commands from previous posts into this file in the following configuration:

@echo off

taskkill /F /IM iexplorer.exe

taskkill /F /IM iexplore.exe

taskkill /F /IM firefox.exe

taskkill /F /IM chrome.exe

taskkill /F /IM javaw.exe

taskkill /F /IM jqs.exe

taskkill /F /IM jusched.exe

REM Uninstall Java

wmic product where "name like 'java%% 6%%'" call uninstall /nointeractive

wmic product where "name like 'java%% 7%%'" call uninstall /nointeractive

wmic product where "name like 'java%% 8%%'" call uninstall /nointeractive

REM Install JRE x86

msiexec.exe /QN /i "\\server\share\Java\jre1_8_0_65\x86\jre1.8.0_65.msi" TRANSFORMS="\\server\share\Java\jre1_8_0_65\x86\KD_Custom.mst" REBOOT=ReallySuppress

if not errorlevel 0 goto failed

REM Install JRE x64

msiexec.exe /QN /i "\\server\share\Java\jre1_8_0_65\x64\jre1.8.0_65.msi" TRANSFORMS="\\server\share\Java\jre1_8_0_65\x64\KD_Custom.mst" REBOOT=ReallySuppress

if not errorlevel 0 goto failed

REM Return the exit code to Deployment Software

exit /B %EXIT_CODE%

:failed

echo %computername% errored on %date% at %time%>>"\\server\Share\Java\failedinstalls.txt"

exit /B %EXIT_CODE%

Stepping though the script:

Kill tasks that use Java
Uninstall previous version
Install current versions
Send codes back to deployment software

For all of this, you need to make sure that your method of deployment has access to the shared location. You will also want to make sure that the correct files are all living next to each other just as mentioned in previous posts.

Once tested in your environment, you should be able to use your favorite method of deployment to successfully upgrade to the newest version of Java. Please share and comment if you were able to use this information in a successful deployment!

Tips are also appreciated – BTC 1zALFY18ky39ne63Q9SMNFhzJZS6CARFH

Tagged , , , , , , , , ,