简体   繁体   中英

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 '\\srv\netlogon\java\jre-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:\temp\java_install.log\`"`""
)

$proc = Start-Process "\\srv\netlogon\java\jre-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?

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

And calling it:

Execute-Process '\\srv\java\jre-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:\temp\jre-8u45-windows-x64.log'

The option you pass to the installer are only valid for an installation configuration file . If you do not want to use a configuration file you can use the following command line options for a silent install .

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

I am getting an error when I run this

Execute-Process '\srv\java\jre-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:\temp\jre-8u45-windows-x64.log'

Execute-Process: The term 'Execute-Process' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • Execute-Process 'C:\downloads\jre-8u341-windows-i586.exe' -Arguments...
  •  + CategoryInfo: ObjectNotFound: (Execute-Process:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM