Java

Installation procedure

Download file from the web and install silently on the computer

$Install={
    function run{
        $client = new-object System.Net.WebClient
        # Accept oracle cookies
        $cookie = 'oraclelicense=accept-securebackup-cookie'
        $client.Headers.Add([System.Net.HttpRequestHeader]::Cookie, $cookie)
        $client.downloadFile($url, $dest)
        
        Start-Process -Wait -FilePath $exe_dest -Argument INSTALLCFG=$config_file -PassThru
        
        [System.Environment]::SetEnvironmentVariable('JAVA_HOME', $data, 'Machine')
        [System.Environment]::SetEnvironmentVariable('PATH',$Env:Path + ';' +bin\, 'Machine')
    }
}

Start-Process -Wait powershell -Verb runAs -PassThru -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command & {$Install run}"

Last updated

Was this helpful?