Search code examples
javapowershellscriptingsccm

Powershell script to update Java to latest version


We have an application that is Java dependent that we are working on a SCCM installer to push out to clients.

Due to Java being updated almost monthly (and the old updates expiring 30 days thereafter) we're looking for a way to have the SCCM installer stay updated with the latest Java version. We have the ability to run a Powershell script from our SCCM installer, but we haven't found a way to write a script that will automatically download and install the latest Java version.

Does anyone know if this is possible, and how we could go about it?

Thanks in advance!!


Solution

  • You can probably use the links available on this page for the download: http://java.com/en/download/manual.jsp

    Alternatively, you can do the download once and put it on a file share so you can use simple methods for copying the file from a UNC path like

    \\fileserver\folder\installerpackage.exe
    

    Just be prepared for headaches. Having dealt with removing and upgrading Java on dozens of machines myself, I can tell you it's not always a clean uninstall/reinstall. Unless they've improved the uninstaller, there's a good chance you will eventually hit a situation where Java's installer thinks it's installed, but it's not. I've also seen the opposite where it thinks it's not installed but it is.