Skip to content

Instantly share code, notes, and snippets.

@jsam2412
Forked from chrisdpa-tvx/install_java.ps1
Created May 5, 2020 05:41
Show Gist options
  • Save jsam2412/6fcf2bd74240daf751f3393cfa18a2bf to your computer and use it in GitHub Desktop.
Save jsam2412/6fcf2bd74240daf751f3393cfa18a2bf to your computer and use it in GitHub Desktop.
Install Java JRE on windows silently using powershell
$URL=(Invoke-WebRequest -UseBasicParsing https://www.java.com/en/download/manual.jsp).Content | %{[regex]::matches($_, '(?:<a title="Download Java software for Windows Online" href=")(.*)(?:">)').Groups[1].Value}
Invoke-WebRequest -UseBasicParsing -OutFile jre8.exe $URL
Start-Process .\jre8.exe '/s REBOOT=0 SPONSORS=0 AUTO_UPDATE=0' -wait
echo $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment