Notification

Icon
Error

Install java and remove old java

Posted: Tuesday, February 9, 2016 4:33:48 PM(UTC)
MrShides

MrShides

Member Original PosterPosts: 2
5
Like
Hello, this installer uses a bit of the other installers posted here and mixes them into one. This is set to only update windows 7 installs with java 32 bit and remove any other versions. Our main application vendor doesn't support the 32 bit version of java/ie at this time so installing the 64 bit is an unsupported configuration for us.

Modify as you like. The PS script can be find on this forum as well as the java installer that this is based on. All credit to those parties for building the foundation this is built on.
Installer - Java Runtime Environment 8Download Package
DescriptionInstalls JRE 8

Parameters in the install steps can be changed. More details under http://www.oracle.com/technetwork/java/javase/silent-136552.html
Final ActionNothing
Max. Duration10 min(s), 0 hour(s)
RescanNo
Steps
1. Check for Windows 7
TypeCondition
SuccessGo To Next
FailureStop (Success)
Conditions
Registry HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion ProductName Has Value Windows 7 Professional
2. Check if already installed 6432
TypeCondition
SuccessStop (Success)
FailureGo To Next
Conditions
Registry HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83218051F0} DisplayVersion Has Value 8.0.730.2
3. Inform user
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureStop (Failure)
Command Msg.exe * Java will get updated now. All browsers will be closed in 15 seconds. This process takes approximitely five minutes and a message will be displayed when installation is complete. Do not use your computer during this time.
4. Wait 15 seconds
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureStop (Failure)
Command timeout 15 > NUL
5. Close IE
TypeKill Process
Return Codes 0,1641,3010,128
SuccessGo To Next
FailureStop (Failure)
Command taskkill /im iexplore.exe /f
6. Close Firefox
TypeKill Process
Return Codes 0,1641,3010,128
SuccessGo To Next
FailureStop (Failure)
Command taskkill /im firefox.exe /f
7. Close Chrome
TypeKill Process
Return Codes 0,1641,3010,128
SuccessGo To Next
FailureStop (Failure)
Command taskkill /im chrome.exe /f
8. Close Opera
TypeKill Process
Return Codes 0,1641,3010,128
SuccessGo To Next
FailureStop (Failure)
Command taskkill /im opera.exe /f
9. Check installer file (x86)
TypeCondition
SuccessGo To Next
FailureStop (Failure)
Conditions
File {PackageShare}\Installers\Java Runtime Environment 8\ jre-8u73-windows-i586.exe Exists
10. Install (x86)
TypeInstaller
Return Codes 0,1641,3010
SuccessGo To Next
FailureStop (Failure)
Command "{PackageShare}\Installers\Java Runtime Environment 8\jre-8u73-windows-i586.exe" /s /lang=1033
11. Disable auto update
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureStop (Failure)
Command REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /V EnableJavaUpdate /T REG_DWORD /D 0 /F & REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /V EnableJavaUpdate /T REG_DWORD /D 0 /F
12. Remove_old_java_versions.ps1
TypeCondition
SuccessGo To Step 13
FailureStop (Failure)
Conditions
File {PackageShare}\Scripts Remove_old_java_versions.ps1 Exists
13. Call Script Uninstall Old Java
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureStop (Failure)
Command powershell -executionpolicy bypass -File "{PackageShare}\Scripts\Remove_old_java_versions.ps1"
14. Inform User Complete
TypeCommand
Return Codes 0,1641,3010
SuccessStop (Success)
FailureStop (Failure)
Command Msg.exe * Your Java update has been completed. Please click OK to continue and you can now use your computer.
SUndie
#1SUndie Member Posts: 4  
posted: 2/22/2016 9:35:16 PM(UTC)
Step 11 (disable auto update) can be skipped by adding

AUTO_UPDATE=0

the the installer line.

For example:

"{PackageShare}\Java\jre-8u73-windows-i586.exe" INSTALL_SILENT=Enable AUTO_UPDATE=0 REBOOT=Disable EULA=Disable REMOVEOUTOFDATEJRES=Disable SPONSORS=Disable

The switches are all documented here: http://docs.oracle.com/j...talling_with_config_file

While the document says "with a config file", the switches can be passed just fine on the command line.

Since you do the uninstallers in a separate step, REMOVEOUTOFDATEJRES=Disable is probably another good switch, and will save time and stalling out in the installer if the previous version of Java is corrupt.
ctw
#2ctw Member Posts: 16  
posted: 3/11/2016 3:58:10 PM(UTC)
I'm confused about closing FF and Chrome since they use built in extensions for handling java and don't care about local installed versions. Also why target registry at only one version of java when you can just run wmic to uninstall all version prior to current like: wmic product where "name like 'java%%' and version<'8.0.6'" call uninstall
EleaCarm
#3EleaCarm Member Posts: 3  
posted: 4/21/2017 5:16:06 PM(UTC)
I had problems with PowerShell 1 and Windows 10 for 2 reasons:

1. The execution security of powershell is restricted "Get-ExecutionPolicy" .

Fixed by executing "Set-ExecutionPolicy -ExecutionPolicy Unrestricted"


2. The script does not correctly convert the string to the question. The question in the script:

If (($ app.Version -ne $ newest64bitVersion) -and ($ newest64bitVersion -ne $ null)) {

I do not operate correctly because $ newest64bitVersion returns a collection of number and not a string. The line I operate correctly is:

If (("$ app.Version" -ne "$ newest64bitVersion") -and ($ newest64bitVersion -ne $ null)) {


3. As an alternative method, VBScript is executed, which is attached.
Handles attachments
Remove_old_java_versions.txt (3kb) downloaded 443 time(s).

Active Discussions

Lansweeper Device Duplicates
by  Ian.Prentice   Go to last post Go to first unread
Last post: 7/23/2021 11:33:00 AM(UTC)
Lansweeper Anti-Virus on Mac
by  Ian.Prentice  
Go to last post Go to first unread
Last post: 7/23/2021 9:04:13 AM(UTC)
Lansweeper Computers Listed as Users
by  td1020   Go to last post Go to first unread
Last post: 7/22/2021 5:16:19 PM(UTC)
Lansweeper Can not see second server in error
by  Jürgen  
Go to last post Go to first unread
Last post: 7/22/2021 3:47:19 PM(UTC)
Lansweeper OU missing
by  Fred   Go to last post Go to first unread
Last post: 7/22/2021 2:08:05 PM(UTC)
Lansweeper Certificate status & end dates
by  VysJamesk  
Go to last post Go to first unread
Last post: 7/22/2021 1:07:02 PM(UTC)
Lansweeper NIST 800-171 Compliance
by  rader  
Go to last post Go to first unread
Last post: 7/20/2021 10:13:17 PM(UTC)