/build/static/layout/Breadcrumb_cap_w.png

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login
Views: 19k  |  Created: 03/11/2015 by: mpace

Average Rating: 0
Java 8 has 1 inventory records, 14 Questions, 0 Blogs and 0 links. Please help add to this by sharing more!

Deployment Tips (4)

Most Common Setup Type
Windows Installer (Delivered as an EXE)
Average Package Difficulty Rating
Rated 3 / 5 (Average) based on 3 ratings
Most Commonly Reported Deployment Method
Windows Installer Command Line (No MST)
2
Command Line
Silent install of Java 8 Update 40 MSI: msiexec /i jre1.8.0_40.msi AUTO_UPDATE=0 EULA=0 NOSTARTMENU=1 SPONSORS=0 WEB_ANALYTICS=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H /qb

The MSI can be found in %appdata&\LocalLow\Sun\Java\jre1.8.0_40_x64\ while the EXE Java installer is open.

An alternate option is using a config file for customizing the installation: http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html
Setup Information:
Setup Type: Windows Installer (MSI)
Deployment Method Used: Windows Installer Command Line (No MST)
Deployment Difficulty: unspecified
Platform(s): Windows
1
Script
This vbscript will extract the msi's from the exe files provided by Oracle and place them into folder the "Extracted" folder inside the working directory. Have fun guys!

'Define Target Computer
strComputer = "."

'Set object values
Set oArguments = WScript.Arguments.Named
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oDrives = oFSO.Drives
Set oShell = CreateObject("WScript.Shell")
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\CIMV2")

'Define ASCII Characters
chrSpace = Chr(32)
chrSingleQuote = Chr(39)
chrDoubleQuote = Chr(34)

'Define Folder Locations
WorkingDir = oFSO.GetParentFolderName(WScript.ScriptFullName)
SoftwareTempDir = oFSO.GetParentFolderName(oShell.ExpandEnvironmentStrings("%APPDATA%")) & "\LocalLow\Sun\Java"

'Define Variables
CurrentDate = Replace(Date, chrSpace, "")

'Gather information from WMI

'Query # 1 - Determine the Operating System Architecture
Set oArchitectures = oWMI.ExecQuery("Select * from Win32_OperatingSystem")
    ForEach oArchitecturein oArchitectures
        OSArchitecture = oArchitecture.OSArchitecture
    Next    
'Modify the string value of the "OSArchitecture" variable
If (OSArchitecture = "32-bit") Then
    OSArchitecture = "x86"
ElseIf (OSArchitecture = "64-bit") Then
    OSArchitecture = "x64"
EndIf

'Remove software temporary directory
If (oFSO.FolderExists(oFSO.GetParentFolderName(SoftwareTempDir))) Then
    RemoveSoftwareTempDir = oFSO.DeleteFolder(oFSO.GetParentFolderName(SoftwareTempDir), True)
EndIf

'Create the required folder(s)
IfNot oFSO.FolderExists(WorkingDir & "\Source") Then
    oFSO.CreateFolder(WorkingDir & "\Source")
EndIf
IfNot oFSO.FolderExists(WorkingDir & "\Extracted") Then
    oFSO.CreateFolder(WorkingDir & "\Extracted")
EndIf

'Open the Java files one at a time, this allows the MSI files to be extracted
Set SourceDir = oFSO.GetFolder(WorkingDir & "\Source")
Set oFiles = SourceDir.Files
Set LatestFilex86 = Nothing
Set LatestFilex64 = Nothing
ForEach oFileIn oFiles
If (InStr(oFile.Name, "jre") > 0) And (InStr(oFile.Name, "i586") > 0) Then
    If (LatestFilex86IsNothing) Then
        Set LatestFilex86 = oFile
    ElseIf (oFSO.GetFileVersion(oFile.Path)) > (oFSO.GetFileVersion(LatestFilex86.Path)) Then
        Set LatestFilex86 = oFile
    EndIf
EndIf
If (InStr(oFile.Name, "jre") > 0) And (InStr(oFile.Name, "x64") > 0) Then
    If (LatestFilex64IsNothing) Then
        Set LatestFilex64 = oFile
    ElseIf (oFSO.GetFileVersion(oFile.Path)) > (oFSO.GetFileVersion(LatestFilex64.Path)) Then
        Set LatestFilex64 = oFile
    EndIf
EndIf    
Next    

'Extract the version number from each file name
arrLatestFilex86 = Split(LatestFilex86, "-")
arrLatestFilex64 = Split(LatestFilex64, "-")
LatestFileVersionx86 = arrLatestFilex86(1)
LatestFileVersionx64 = arrLatestFilex64(1)
LatestFileArchitecturex86 = "x86"
LatestFileArchitecturex64 = "x64"

'Create the destination folders
IfNot (oFSO.FolderExists(WorkingDir & "\Extracted\" & LatestFileVersionx86 & "\x86")) Then
    CreateDestinationFolderx86 = oShell.Run("cmd.exe /c mkdir" & chrSpace & chrDoubleQuote & WorkingDir & "\Extracted\" & LatestFileVersionx86 & "\x86" & chrDoubleQuote, 0, True)
EndIf
IfNot (oFSO.FolderExists(WorkingDir & "\Extracted\" & LatestFileVersionx64 & "\x64")) Then
    CreateDestinationFolderx64 = oShell.Run("cmd.exe /c mkdir" & chrSpace & chrDoubleQuote & WorkingDir & "\Extracted\" & LatestFileVersionx64 & "\x64" & chrDoubleQuote, 0, True)
EndIf

comRunLatestFilex86 = oShell.Run(chrDoubleQuote & LatestFilex86.Path & chrDoubleQuote, 1, False)
WScript.Sleep(15000)
comTerminateLatestFilex86 = oShell.Run("taskkill.exe" & chrSpace & "/im" & chrSpace & chrDoubleQuote & LatestFilex86.Name & chrDoubleQuote & chrSpace & "/f", 0, True)
WScript.Sleep(15000)

If (OSArchitecture = "x64") Then
    comRunLatestFilex64 = oShell.Run(chrDoubleQuote & LatestFilex64.Path & chrDoubleQuote, 1, False)
    WScript.Sleep(15000)
    comTerminateLatestFilex64 = oShell.Run("taskkill.exe" & chrSpace & "/im" & chrSpace & chrDoubleQuote & LatestFilex64.Name & chrDoubleQuote & chrSpace & "/f", 0, True)
    WScript.Sleep(15000)
EndIf

Set SoftwareTempDir = oFSO.GetFolder(SoftwareTempDir)
Set oSubfolders = SoftwareTempDir.SubFolders
ForEach oSubFolderIn oSubFolders
    arrDateModified = Split(oSubFolder.DateLastModified, chrSpace)
    DateModified = arrDateModified(0)   
    If (DateModified = CurrentDate) And (InStr(oSubFolder.Name, "jre") > 0) AndNot (InStr(oSubFolder.Name, "x64") > 0) Then
        CopySourceFolder = oFSO.CopyFolder(oSubFolder.Path, WorkingDir & "\Extracted\" & LatestFileVersionx86 & "\" & LatestFileArchitecturex86, True)        
    EndIf
    If (DateModified = CurrentDate) And (InStr(oSubFolder.Name, "jre") > 0) And (InStr(oSubFolder.Name, "x64") > 0) Then
        CopySourceFolder = oFSO.CopyFolder(oSubFolder.Path, WorkingDir & "\Extracted\" & LatestFileVersionx64 & "\" & LatestFileArchitecturex64, True)        
    EndIf
Next

'Remove software temporary directory
If (oFSO.FolderExists(oFSO.GetParentFolderName(SoftwareTempDir))) Then
    RemoveSoftwareTempDir = oFSO.DeleteFolder(oFSO.GetParentFolderName(SoftwareTempDir), True)
EndIf

WScript.Echo("MSI Extraction Completed Successfully!")

Setup Information:
Setup Type: Windows Installer (Delivered as an EXE)
Deployment Method Used: Windows Installer with Custom Transform (MST)
Deployment Difficulty: Average
Platform(s): Windows
0
Script

Grab the 32-bit JRE installer EXE from Oracle and extract the MSI.  Rename it to jre-8-windows-i586.msi.  This is so that you can re-use the script and just change versions in one location in the script as future versions come out.  Perhaps use the tip from truealph to do the extraction.

NOTE: You are not entitled to use the "Enterprise MSI installer" labeled as such that you can download from the Oracle Support site, unless you have a valid Java SE support contract costing $10,000+, so just use the normal exe and extract the MSI.

We use a VBScript wrapper for all of our deployments.  In SCCM (or elsewhere), just call "cscript.exe Install-OracleJavaRuntimeEnvironment.vbs". 

Uninstall is "cscript.exe Uninstall-OracleJavaRuntimeEnvironment.vbs".  I don't actually use the uninstaller, preferring instead to check that IE isn't running, and taking care of the uninstall of previous installations in the install script prior to actually installing the new version.

All the other required  files are here.  Save them all at the root level along with the .msi and Install-OracleJavaRuntimeEnvironment.vbs

This script relies on a log folder %WINDIR%\CCM\Logs existing.  If you're running SCCM, it will exist.  If not, change the path for each location to your desired logging directory.


***** START OF Install-OracleJavaRuntimeEnvironment.vbs *****

Option Explicit

Dim objShell, objFSO
Dim strApplicationShortName, strCurrentVersion, strInstallMSI
Dim strInstallCommandLine, strLogFile
Dim strLogPath, strInstallCMD, strInstallLogPath, strCurrentDirectory, qt, strFileToCopy, strWindowsDirectory
Dim objSysEnv, Path, NewPath, PathToAdd
Dim strUninstallGUID, strUninstallLogPath, strUninstallCommandLine
Dim objWMI, colProcessList
Dim arrPathEntries, n, PathItem, PathToRemove
Dim strProcessKill, objProcess

Const WindowsFolder = 0

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

qt = Chr(34)
strCurrentDirectory = objFSO.GetParentFolderName(WScript.ScriptFullName)
Set strWindowsDirectory = objFSO.GetSpecialFolder(WindowsFolder)

' Check to see if Internet Explorer is running, and quit the script if it is, as the install will fail otherwise. 
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name = 'iexplore.exe'")
If Not colProcessList.Count = 0 Then
WScript.Quit
End If
Set colProcessList = Nothing

' Kill any remaining non-IE Java processes
strProcessKill = "'java%.exe'"
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name LIKE " & strProcessKill )
For Each objProcess In colProcessList
 objProcess.Terminate()
 WScript.sleep 2000
Next

' Kill any remaining non-IE-related jp2launcher processes
strProcessKill = "'jp2launcher.exe'"
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess In colProcessList
 objProcess.Terminate()
 WScript.sleep 2000
Next

If objFSO.FileExists("C:\Program Files (x86)\Java\jre6\bin\java.exe") Then

 '=============================================================================================================
 'Uninstall any JRE6 versions (you might need to add to this list if you have any additional installs)
 '=============================================================================================================
 strApplicationShortName = "JavaSecurityFiles" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "6.0" 'application version, e.g. 6.1.7601
 strUninstallGUID = "8560E04B-6144-4783-96B3-959887F91784" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "6.0.650" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83216065FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "6.0.450" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83216045FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "6.0.390" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83216039FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "6.0.380" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83216038FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 
 WScript.sleep 10000

 'Remove JRE 6 from path
 Set objSysEnv = objShell.Environment("SYSTEM")
 Path = objSysEnv("PATH")
 NewPath = ""
 PathToRemove = "c:\Program Files (x86)\Java\jre6\bin"
 
 arrPathEntries = split(Path,";")
 For n = 0 to ubound(arrPathEntries)
  PathItem = arrPathEntries(n)
  If lcase(PathItem) <> lcase(PathToRemove) Then
   NewPath = NewPath & arrPathEntries(n) & ";"
  End If
 Next
 objSysEnv.Item("PATH") = NewPath
 Set objSysEnv = Nothing
 NewPath = ""
 Path = ""
 
 'Delete remnants of JRE 6 folder
 If objFSO.FolderExists("C:\Program Files (x86)\Java\jre6") Then
  objFSO.DeleteFolder "C:\Program Files (x86)\Java\jre6",True
 End If
 '=============================================================================================================
End If

If objFSO.FileExists("C:\Program Files (x86)\Java\jre7\bin\java.exe") Then
 '=============================================================================================================
 'Uninstall any JRE7 versions (you might need to add to this list if you have any additional installs)
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.760" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F03217076FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.720" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F03217072FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.650" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F03217065FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.550" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83217055FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.510" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83217051FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "7.0.450" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83216045FF" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================

 WScript.sleep 10000

 'Remove JRE 7 from path
 Set objSysEnv = objShell.Environment("SYSTEM")
 Path = objSysEnv("PATH")
 NewPath = ""
 PathToRemove = "c:\Program Files (x86)\Java\jre7\bin"
 
 arrPathEntries = split(Path,";")
 For n = 0 to ubound(arrPathEntries)
  PathItem = arrPathEntries(n)
  If lcase(PathItem) <> lcase(PathToRemove) Then
   NewPath = NewPath & arrPathEntries(n) & ";"
  End If
 Next
 objSysEnv.Item("PATH") = NewPath
 Set objSysEnv = Nothing
 NewPath = ""
 Path = ""
 
 'Delete remnants of JRE 7 folder
 If objFSO.FolderExists("C:\Program Files (x86)\Java\jre7") Then
  objFSO.DeleteFolder "C:\Program Files (x86)\Java\jre7",True
 End If
 '=============================================================================================================
End If


If objFSO.FileExists("C:\Program Files (x86)\Java\jre8\bin\java.exe") Then
 '=============================================================================================================
 'Uninstall any JRE8 versions (you might need to add to this list if you have any additional installs)
 '=============================================================================================================
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "8.0.400" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83218040F0" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '============================================================================================================= 
 strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
 strCurrentVersion = "8.0.310" 'application version, e.g. 6.1.7601
 strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83218031F0" 'insert application GUID, WITHOUT the curly brackets
 strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
 strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath
 objShell.Run strUninstallCommandLine,0,True
 '=============================================================================================================
 WScript.sleep 10000

 'Remove JRE 8 from path
 Set objSysEnv = objShell.Environment("SYSTEM")
 Path = objSysEnv("PATH")
 NewPath = ""
 PathToRemove = "c:\Program Files (x86)\Java\jre8\bin"
 
 arrPathEntries = split(Path,";")
 For n = 0 to ubound(arrPathEntries)
  PathItem = arrPathEntries(n)
  If lcase(PathItem) <> lcase(PathToRemove) Then
   NewPath = NewPath & arrPathEntries(n) & ";"
  End If
 Next
 objSysEnv.Item("PATH") = NewPath
 Set objSysEnv = Nothing
 NewPath = ""
 Path = ""
 
 'Delete remnants of JRE 8 folder
 If objFSO.FolderExists("C:\Program Files (x86)\Java\jre8") Then
  objFSO.DeleteFolder "C:\Program Files (x86)\Java\jre8",True
 End If
 '=============================================================================================================
End If

'=============================================================================================================
'Define the values of the application installation here
'=============================================================================================================
strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
strCurrentVersion = "8.0.400" 'application version, e.g. 6.1.7601 (change this for each version)
strInstallMSI = "jre-8-windows-i586" 'name of MSI file WITHOUT the MSI extension  (remember to rename the .msi itself from jre-8u40-windows-i586.msi)
'=============================================================================================================
'Pre-stage java.settings.cfg to workaround this bug:
'https://bugs.openjdk.java.net/browse/JDK-8071303?page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel
'Delete it if it's already there, though, or you will get a permission denied error.

If objFSO.FileExists("C:\ProgramData\Oracle\Java\java.settings.cfg") Then
 objFSO.DeleteFile "C:\ProgramData\Oracle\Java\java.settings.cfg",True
End If 

If objFSO.FolderExists("C:\ProgramData\Oracle") = False Then
 objFSO.CreateFolder "C:\ProgramData\Oracle"
End If
If objFSO.FolderExists("C:\ProgramData\Oracle\Java") = False Then
 objFSO.CreateFolder "C:\ProgramData\Oracle\Java"
End If
If objFSO.FolderExists("C:\ProgramData\Oracle\Java") Then
 If objFSO.FileExists(strCurrentDirectory & "\java.settings.cfg") Then
  objFSO.CopyFile strCurrentDirectory & "\java.settings.cfg","C:\ProgramData\Oracle\Java\java.settings.cfg",True
 End If 
End If 

WScript.sleep 2000

'Sets the location of the installation log
strInstallLogPath = strWindowsDirectory & "\CCM\LOGS\Install_" & strApplicationShortName & "_" & strCurrentVersion & ".log"
'Build application install command line
strInstallCommandLine = "msiexec.exe /i " & qt & strCurrentDirectory & "\" & strInstallMSI & ".msi" & qt & " INSTALLCFG=" & qt & strCurrentDirectory & "\install.cfg" & qt & " INSTALLDIR=" & qt & "C:\Program Files (x86)\Java\jre8" & qt & " REBOOT=ReallySuppress /qn /LiV " & strInstallLogPath
'Installs the Application. It will wait for the command to finish executing before continuing
objShell.Run strInstallCommandLine,0,True

'Add JRE to beginning of path (if it's not already there)
Set objSysEnv = objShell.Environment("SYSTEM")
Path = objSysEnv("PATH")
PathToAdd = "C:\Program Files (x86)\Java\jre8\bin"
If Not InStr(LCase(Path), LCase(PathToAdd)) > 0 Then
 Path = PathToAdd & ";" & Path
 objSysEnv.Item("PATH") = Path
End If
Set objSysEnv = Nothing
Path = ""

'Configure Oracle Java Runtime Environment
Dim strCurrentRegFile
strCurrentRegFile = qt & strCurrentDirectory & "\DisableJQSService.reg" & qt
objShell.Run "regedit.exe /s " & strCurrentRegFile,0,True
strCurrentRegFile = qt & strCurrentDirectory & "\noautoupdate.reg" & qt
objShell.Run "regedit.exe /s " & strCurrentRegFile,0,True
strCurrentRegFile = qt & strCurrentDirectory & "\DisableSponsors.reg" & qt
objShell.Run "regedit.exe /s " & strCurrentRegFile,0,True

'Prevent Java expiration check, which is different to AutoUpdate.  This one removes the Update or Block prompt.

If objFSO.FolderExists("C:\Windows\Sun") = False Then
 objFSO.CreateFolder "C:\Windows\Sun"
End If
If objFSO.FolderExists("C:\Windows\Sun\Java") = False Then
 objFSO.CreateFolder "C:\Windows\Sun\Java"
End If
If objFSO.FolderExists("C:\Windows\Sun\Java\Deployment") = False Then
 objFSO.CreateFolder "C:\Windows\Sun\Java\Deployment"
End If

If objFSO.FolderExists("C:\Windows\Sun\Java\Deployment") Then
 If objFSO.FileExists(strCurrentDirectory & "\deployment.config") Then
  objFSO.CopyFile strCurrentDirectory & "\deployment.config","C:\Windows\Sun\Java\Deployment\deployment.config",True
 End If
 If objFSO.FileExists(strCurrentDirectory & "\deployment.properties") Then
  objFSO.CopyFile strCurrentDirectory & "\deployment.properties","C:\Windows\Sun\Java\Deployment\deployment.properties",True
 End If
End If

''If you need to copy custom policy and security files to get specific old-school Java apps to work, do it here.  It's commented out though.
'If objFSO.FolderExists("C:\Program Files (x86)\Java\jre8\lib\security") Then
' If objFSO.FileExists(strCurrentDirectory & "\java.policy") Then
'  objFSO.CopyFile strCurrentDirectory & "\java.policy","C:\Program Files (x86)\Java\jre8\lib\security\java.policy",True
' End If
' If objFSO.FileExists(strCurrentDirectory & "\java.security") Then
'  objFSO.CopyFile strCurrentDirectory & "\java.security","C:\Program Files (x86)\Java\jre8\lib\security\java.security",True
' End If
' If objFSO.FileExists(strCurrentDirectory & "\local_policy.jar") Then
'  objFSO.CopyFile strCurrentDirectory & "\local_policy.jar","C:\Program Files (x86)\Java\jre8\lib\security\local_policy.jar",True
' End If 
' If objFSO.FileExists(strCurrentDirectory & "\US_export_policy.jar") Then
'  objFSO.CopyFile strCurrentDirectory & "\US_export_policy.jar","C:\Program Files (x86)\Java\jre8\lib\security\US_export_policy.jar",True
' End If
'End If

'Force user config to prevent update/later/block security dialog when new version released
If objFSO.FileExists("c:\Program Files (x86)\Java\jre8\bin\javaws.exe") Then
 strInstallCommandLine = qt & "c:\Program Files (x86)\Java\jre8\bin\javaws.exe" & qt & " -userConfig deployment.expiration.check.enabled false"
 objShell.Run strInstallCommandLine,0,True
 WScript.sleep 5000
End If

set objShell = Nothing
set objFSO = Nothing


***** END OF Install-OracleJavaRuntimeEnvironment.vbs *****


Additional files used by the script:


***** START OF install.cfg *****

STATIC=Disable
AUTO_UPDATE=Disable
WEB_ANALYTICS=Disable
NOSTARTMENU=Enable
REBOOT=Disable

***** END OF install.cfg *****


***** START OF java.settings.cfg *****

AUTO_UPDATE=Disable
WEB_ANALYTICS=Disable

***** END OF java.settings.cfg *****


***** START OF DisableJQSService.reg *****

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\JavaQuickStarterService]
"Type"=dword:00000010
"Start"=dword:00000004
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,4a,00,61,00,76,00,61,00,5c,\
  00,6a,00,72,00,65,00,36,00,5c,00,62,00,69,00,6e,00,5c,00,6a,00,71,00,73,00,\
  2e,00,65,00,78,00,65,00,22,00,20,00,2d,00,73,00,65,00,72,00,76,00,69,00,63,\
  00,65,00,20,00,2d,00,63,00,6f,00,6e,00,66,00,69,00,67,00,20,00,22,00,43,00,\
  3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,00,46,00,69,00,6c,\
  00,65,00,73,00,5c,00,4a,00,61,00,76,00,61,00,5c,00,6a,00,72,00,65,00,36,00,\
  5c,00,6c,00,69,00,62,00,5c,00,64,00,65,00,70,00,6c,00,6f,00,79,00,5c,00,6a,\
  00,71,00,73,00,5c,00,6a,00,71,00,73,00,2e,00,63,00,6f,00,6e,00,66,00,22,00,\
  00,00
"DisplayName"="Java Quick Starter"
"ObjectName"="LocalSystem"
"Description"="Prefetches JRE files for faster startup of Java applets and applications"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\JavaQuickStarterService\Security]
"Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\
  00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
  00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
  05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
  20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\
  00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\
  00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\JavaQuickStarterService\Enum]
"0"="Root\\LEGACY_JAVAQUICKSTARTERSERVICE\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001

***** END OF DisableJQSService.reg *****


***** START OF noautoupdate.reg *****

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy]
"EnableJavaUpdate"=dword:00000000
"NotifyDownload"=dword:00000001
"NotifyInstall"=dword:00000001
"LastUpdateBeginTime"=""
"LastUpdateFinishTime"=""
"UpdateSchedule"=dword:0000000f
"Frequency"=dword:010f0000
"EnableAutoUpdateCheck"=dword:00000000
"PromptAutoUpdateCheck"=-
"VisitorId"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"SunJavaUpdateSched"=-


***** END OF noautoupdate.reg *****

***** START OF DisableSponsors.reg *****

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JreMetrics]
"DisableSponsors"="Y"

***** END OF DisableSponsors.reg *****



***** START OF deployment.config *****

deployment.system.config=file:///C:/Windows/Sun/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true

***** END OF deployment.config *****


***** START OF deployment.properties *****

deployment.expiration.check.enabled=false

***** END OF deployment.properties *****


***** START OF Uninstall-OracleJavaRuntimeEnvironment.vbs *****

Option Explicit

Dim objShell, objFSO, strAllUsersStartMenu
Dim strApplicationShortName, strCurrentVersion, strUninstallGUID
Dim strUninstallCommandLine, strUninstallLogPath, strCurrentDirectory, qt, strWindowsDirectory
Dim objSysEnv, Path, NewPath, PathToAdd
Dim objWMI, colProcessList
Dim arrPathEntries, n, PathItem, PathToRemove
Dim strProcessKill, objProcess

Const CommonAppData = &H23&
Const CSIDL_PROGRAM_FILESX86 = &H2a
Const WindowsFolder = 0

Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
qt = Chr(34)

'Determines the current folder the script is being run from, and the Windows directory for logging.
strCurrentDirectory = objFSO.GetParentFolderName(WScript.ScriptFullName)
Set strWindowsDirectory = objFSO.GetSpecialFolder(WindowsFolder)

' Check to see if Internet Explorer is running, and quit the script if it is. 
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name = 'iexplore.exe'")
If Not colProcessList.Count = 0 Then
WScript.Quit
End If
Set colProcessList = Nothing

' Kill any remaining non-IE-related Java processes
strProcessKill = "'java%.exe'"
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name LIKE " & strProcessKill )
For Each objProcess In colProcessList
 objProcess.Terminate()
 WScript.sleep 2000
Next

' Kill any remaining non-IE-related jp2launcher processes
strProcessKill = "'jp2launcher.exe'"
Set colProcessList = objWMI.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess In colProcessList
 objProcess.Terminate()
 WScript.sleep 2000
Next

'=============================================================================================================
'Define the values of the application uninstallation here
'=============================================================================================================
strApplicationShortName = "OracleJavaRuntimeEnvironment" 'application name without spaces, e.g. MicrosoftOfficeProPlus
strCurrentVersion = "8.0.400" 'application version, e.g. 6.1.7601
strUninstallGUID = "26A24AE4-039D-4CA4-87B4-2F83218040F0" 'insert application GUID, WITHOUT the curly brackets
'=============================================================================================================

'Sets the location of the uninstallation log
strUninstallLogPath = strWindowsDirectory & "\CCM\LOGS\Uninstall_" & strApplicationShortName & "_" & strCurrentVersion & ".log"

'Build application uninstall command line
strUninstallCommandLine = "MsiExec.exe /x{" & strUninstallGUID & "} REBOOT=ReallySuppress /qn /Liv " & strUninstallLogPath

'Uninstalls the Application. It will wait for the command to finish executing before continuing
objShell.Run strUninstallCommandLine,0,True

WScript.sleep 5000

'Remove JRE 8 from path
Set objSysEnv = objShell.Environment("SYSTEM")
Path = objSysEnv("PATH")
NewPath = ""
PathToRemove = "c:\Program Files (x86)\Java\jre8\bin"

arrPathEntries = split(Path,";")
For n = 0 to ubound(arrPathEntries)
 PathItem = arrPathEntries(n)
 If lcase(PathItem) <> lcase(PathToRemove) Then
  NewPath = NewPath & arrPathEntries(n) & ";"
 End If
Next
objSysEnv.Item("PATH") = NewPath
Set objSysEnv = Nothing
NewPath = ""
Path = ""

If objFSO.FolderExists("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Java") Then
 objFSO.DeleteFolder "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Java",True
End If

set objShell = Nothing
set objFSO = Nothing


***** END OF Uninstall-OracleJavaRuntimeEnvironment.vbs *****


Setup Information:
Setup Type: Windows Installer (MSI)
Deployment Method Used: Vendor Provided Command Line (switch driven)
Deployment Difficulty: Average
Platform(s): Windows
0
Note

I created some documentation and a utility to aid with Java Deployment Rule Sets. Oracle's documentation is HERE for Manifest.txt.

All of the files are located HERE shared on my DropBox. I updated the WiseScript so it prompts you for your company name. The WiseScript will use the company name you input for the "Blocked by <Your Company Name>" in the last rule that blocks everything not specified.

Please view the README.txt for details on each of the files.
 
Please let me know if you have any questions.
 
Any and all feedback is greatly appreciated!
-Kevin


Setup Information:
Setup Type: unspecified
Deployment Method Used: unspecified
Deployment Difficulty: unspecified
Platform(s): Windows
This content is currently hidden from public view.
Reason: Removed by member request For more information, visit our FAQ's.

Inventory Records (1)

View inventory records anonymously contributed by opt-in users of the K1000 Systems Management Appliance.

Versions

Java 8

Version

8 Update 40

Questions & Answers (14)

Questions & Answers related to Oracle Java 8

0
ANSWERS
2
ANSWERS
2
ANSWERED
0
ANSWERS
2
ANSWERED
2
ANSWERS
9
ANSWERED
0
ANSWERS
5
ANSWERS
4
ANSWERED
1
ANSWERS
4
ANSWERS

Blogs (0)

Blog posts related to Oracle Java 8

Reviews (0)

Reviews related to Oracle Java 8

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ