ethorup Posted February 23, 2018 Posted February 23, 2018 This script will download the small online installer, generate the silent install cfg file and run the installer. The timer near the end is set for 3 minutes as it has to download the full installer first and Java takes a while to install anyway. If you want to get the latest version just go to https://java.com/en/download/win10.jsp and copy the link from the button that says "Agree and start free download". Then past this link into the $source variable. I find that this installer works on both windows 7 and windows 10. # Download and silent install Java Runtime Environement # working directory path $workd = "c:\temp" # Check if work directory exists if not create it If (!(Test-Path -Path $workd -PathType Container)) { New-Item -Path $workd -ItemType directory } #create config file for silent install $text = ' INSTALL_SILENT=Enable AUTO_UPDATE=Enable SPONSORS=Disable REMOVEOUTOFDATEJRES=1 ' $text | Set-Content "$workd\jreinstall.cfg" #download executable, this is the small online installer $source = "http://javadl.oracle.com/webapps/download/AutoDL?BundleId=230511_2f38c3b165be4555a1fa6e98c45e0808" $destination = "$workd\jreInstall.exe" $client = New-Object System.Net.WebClient $client.DownloadFile($source, $destination) #install silently Start-Process -FilePath "$workd\jreInstall.exe" -ArgumentList INSTALLCFG="$workd\jreinstall.cfg" # Wait 120 Seconds for the installation to finish Start-Sleep -s 180 # Remove the installer rm -Force $workd\jre*
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now