As a Systems Administrator, keeping software up to date is rather important for all sorts of reasons. Updating Java is no exception. So what do you do when you see a Java update available and you have 160+ computers to update? Script it of course.
Update:
That other system works, but the new system is much more reliable and works on both 32bit and 64 bit systems.
Step 1
Download a Java installer from https://ninite.com and place it in a network accessible folder. I also update Notepad++ at the same time since it needs regular updates.
Step 2
Copy the installer to a local folder on each of the servers or computers
psexec @computergroup.txt -u domain\user -p password -n 20 cmd /c copy "\\networkshare\folder\Ninite Java 8 Notepad Installer.exe" c:\scripts
Step 3
Run the installer on all of the servers or computers
psexec @computergroup.txt -u domain\user -p password -n 20 cmd /c "c:\scripts\Ninite Java 8 Notepad Installer.exe"
My Previous Method
Step 1
Remove older versions of Java
run “MyUninstaller” to get the command line script for removing older versions
MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217007FF}
MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216023FF}
I then added the above lines to “java-uninstall.bat”.
Make a C:\scripts directory on all computers on your network.
psexec \\* -u domain\adminuser -p password cmd /c md c:\scripts
Push out java-uninstall.bat to c:\scripts\ folder
psexec \\* -u domain\adminuser -p password cmd /c copy "\\NFS\software\batchfiles\java-uninstall.bat" c:\Scripts
Uninstall Java on all computers
psexec \\* -u domain\adminuser -p password cmd /c c:\Scripts\java-uninstall.bat
Step 2
Download Java offline installer
Create a Java Installer batch file with the following switches. You might want to check these to see if any other switches are needed. Also, specify your own Network File Share.
\\NFS\software\tools\Java\javasetup.exe /s /v" /qn IEXPLORER=1 MOZILLA=1"
Push out java-install.bat to c:\scripts folder
psexec \\* -u domain\adminuser -p password cmd /c copy "\\software\batchfiles\java-install.bat" c:\Scripts
Run the batch java installer.
psexec \\* -u domain\adminuser -p password cmd /c c:\Scripts\java-install.bat
That’s it! Chances are Java will be updated within a few months and this process will need to be repeated. By renaming the java installer, it allows this script to be run whenever Java is updated.