Hi all,
After a bit of playing around I managed to write the following script to deploy Java via GPO as a start-up script. I have tested this and this works without an issue thought i would share in case anyone else is having the same problems as I had.
Get latest EXE from Oracle site for JRE and change java source directory, Install directories and file name below. Server location obviously is where you have the source files placed. You can remove the @echo OFF at beginning if you prefer as i did for testing purposes.
@echo OFF
IF EXIST "%programfiles(x86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
:32BIT
if exist "%programfiles%\Java\jre1.8.0_31\bin\java.exe" goto END
if not exist "%programfiles%\Java\jre1.8.0_31\bin\java.exe" goto INSTALL32
:INSTALL32
title Installing Java
echo Installing Java. . .
set Java32="\\[sERVER LOCATION]\jre-8u31-windows-i586.exe"
if not exist %Java32% set missing=%Java32% & goto ERR1
%Java32% /s REBOOT=Suppress
goto END
:ERR1
cls
echo Unable to locate: %missing%
echo.
goto END
:64BIT
if exist "%programfiles(x86)%\Java\jre1.8.0_31\bin\java.exe" goto END
if not exist "%Programfiles(x86)%\Java\jre1.8.0_31\bin\java.exe" goto INSTALL64
:INSTALL64
title Installing Java
echo Installing Java. . .
set Java32="[sERVER LOCATION]\jre-8u31-windows-i586.exe"
if not exist %Java32% set missing=%Java32% & goto ERR1
%Java32% /s REBOOT=Suppress
goto END
:ERR1
cls
echo Unable to locate: %missing%
echo.
goto END
:END
exit
You can also add the removal of old java to the beginning of the script if required by getting the GUID and adding the following:
msiexec /x {GUID OF OLD JAVA TO REMOVE}
Hope this helps others.