Created
June 11, 2019 02:23
-
-
Save billkindle/f238803e7a361742a3be03328544bb0c to your computer and use it in GitHub Desktop.
This script will download the latest Offline JRE installer for Windows x86 and x64.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# Get-LatestJRE.ps1 | |
Reference: | |
http://servertechs.info/automating-java-download-and-deployment-with-powershell-and-sccm/ | |
#> | |
# First I need to obtain some Uri's from Oracle. I'll sort them out, grabbing only the Windows Offline links | |
$Links = $(Invoke-WebRequest 'http://www.java.com/en/download/manual.jsp' -UserAgent 'Mozilla/5.0 (Windows NT 6.1; wow64)').links | | |
Where-Object -Property innerHTML -like 'Windows Offline*' | | |
Select-Object -Property href, innerHTML | |
# here I take each link and download the latest jre installer | |
Foreach ($Link in $Links) { | |
$file = $Link.innerHTML | |
Invoke-WebRequest -Uri $Link.href -OutFile $env:HOMEPATH\Downloads\jre_"$file"_.exe | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment