Skip to content

Powershell install Java silently

I need to install new Java update silently. I have these arguments for installation:

INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H WEB_ANALYTICS=0 EULA=0 REBOOT=0 NOSTARTMENU=0 SPONSORS=0

and I tried:

Start-Process -Wait '\srvnetlogonjavajre-8u45-windows-i586.exe' -ArgumentList '/s INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H WEB_ANALYTICS=0 EULA=0 REBOOT=0 NOSTARTMENU=0 SPONSORS=0'

and also:

$arguments = @(
    '/s',
    "/v/qn `"INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H WEB_ANALYTICS=0 EULA=0 REBOOT=0 NOSTARTMENU=0 SPONSORS=0 /L `"c:tempjava_install.log`"`""
)

$proc = Start-Process "\srvnetlogonjavajre-8u45-windows-i586.exe" -ArgumentList $arguments -Wait -PassThru
if($proc.ExitCode -ne 0) {
    Throw "ERROR"
}

and both version has prompt dialog. How to install it silently?

Answer

I found solution in cmdLet Execute-Process via this script. Works fine!

And calling it:

Execute-Process '\srvjavajre-8u45-windows-x64.exe' -Arguments '/s INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H WEB_ANALYTICS=0 EULA=0 REBOOT=0 NOSTARTMENU=0 SPONSORS=0 /L c:tempjre-8u45-windows-x64.log'