Problem scenario
You need to install Java version 8 on a Windows 64 bit server. How do you do this with PowerShell?
Solution
1. Open PowerShell ISE as Administrator.
2. Run this script:
# This is a modified version of PowerShell code taken from this site:
# https://skarlso.github.io/2015/06/30/powershell-can-also-be-nice-or-installing-java-silently-and-waiting/
$JDK_VER=”1u151″
$JDK_FULL_VER=”8u151-b12″
$JDK_PATH=”1.8.0_151″
$source86 = “http://download.oracle.com/otn-pub/java/jdk/$JDK_FULL_VER/jdk-$JDK_VER-windows-i586.exe”
$source64 = “http://javadl.oracle.com/webapps/download/AutoDL?BundleId=230542_2f38c3b165be4555a1fa6e98c45e0808”
$destination86 = “C:\Program Files (x86)\$JDK_VER-x86.exe”
$destination64 = “C:\Program Files (x86)\$JDK_VER-x64.exe”
$client = new-object System.Net.WebClient
$cookie = “oraclelicense=accept-securebackup-cookie”
$client.Headers.Add([System.Net.HttpRequestHeader]::Cookie,
…
Continue reading “How Do You Install Java Version 8 on a Windows 64 Bit Server with PowerShell?”