maciejrebisz.com

IT

New Java 1.8.51 has been released – How to upgrade with psappdeploytoolkit – Mobile-First Cloud-First

maximios August 7, 2020

To deploy java in the enterprise you must download it from http://java.com/en/download/manual.jsp install java on a test virtuel machine and get the MSI files from C:Users%username%AppDataLocalLowSunJavajre1.8.0_51

I have in the passed deployed java as any other application in SCCM but have seen some problems with different programs opened and there for was Java not upgraded correctly.

The Preinstallation fase is goining to close Internet Explorer, Chrome, Firefox, javacpl, javaw

And uninstall all previous versions of Java

The Post installation fase is setting regkeys to ensure that auto update is disabled

Now I use Powershell App deployment toolkit : http://psappdeploytoolkit.com./

My app Deploy-Application.ps1 for Java 1.8.51 look like this:

[CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [ValidateSet(‘Install’,’Uninstall’)] [string]$DeploymentType = ‘Install’, [Parameter(Mandatory=$false)] [ValidateSet(‘Interactive’,’Silent’,’NonInteractive’)] [string]$DeployMode = ‘Interactive’, [Parameter(Mandatory=$false)] [switch]$AllowRebootPassThru = $false, [Parameter(Mandatory=$false)] [switch]$TerminalServerMode = $false

)

Try { ## Set the script execution policy for this process Try { Set-ExecutionPolicy -ExecutionPolicy ‘ByPass’ -Scope ‘Process’ -Force -ErrorAction ‘Stop’ } Catch {}##*=============================================== ##* VARIABLE DECLARATION ##*=============================================== ## Variables: Application [string]$appVendor = ‘Oracle’ [string]$appName = ‘Java’ [string]$appVersion = ‘8.51’ [string]$appArch = ” [string]$appLang = ‘EN’ [string]$appRevision = ’01’ [string]$appScriptVersion = ‘1.0.0’ [string]$appScriptDate = ’07/14/2015′

[string]$appScriptAuthor = ‘Per Larsen – http://osddeployment.dk’

##*===============================================##* Do not modify section below

#region DoNotModify

## Variables: Exit Code
[int32]$mainExitCode = 0

## Variables: Script [string]$deployAppScriptFriendlyName = ‘Deploy Application’ [version]$deployAppScriptVersion = [version]’3.6.0′ [string]$deployAppScriptDate = ’03/11/2015′

[hashtable]$deployAppScriptParameters = $psBoundParameters

## Variables: Environment
[string]$scriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent

## Dot source the required App Deploy Toolkit Functions Try { [string]$moduleAppDeployToolkitMain = “$scriptDirectoryAppDeployToolkitAppDeployToolkitMain.ps1” If (-not (Test-Path -Path $moduleAppDeployToolkitMain -PathType Leaf)) { Throw “Module does not exist at the specified location [$moduleAppDeployToolkitMain].” } . $moduleAppDeployToolkitMain } Catch { [int32]$mainExitCode = 1 Write-Error -Message “Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)” -ErrorAction ‘Continue’ Exit $mainExitCode

}

#endregion ##* Do not modify section above ##*=============================================== ##* END VARIABLE DECLARATION

##*===============================================

If ($deploymentType -ine ‘Uninstall’) { ##*=============================================== ##* PRE-INSTALLATION ##*===============================================

[string]$installPhase = ‘Pre-Installation’

## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
Show-InstallationWelcome -CloseApps ‘iexplore,chrome,firefox,javacpl,javaw’

## Show Progress Message (with the default message)
Show-InstallationProgress

##
# Remove any previous versions of Java

# Uninstall Java 8 Update 51 Execute-MSI -Action Uninstall -Path ‘{26A24AE4-039D-4CA4-87B4-2F83218045F0}’ # Uninstall Java 8 Update 45 Execute-MSI -Action Uninstall -Path “{424B311A-EF35-4185-89D1-9473AFCE3D25}” # Uninstall Java 8 Update 31 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83218031F0}” # Uninstall Java 8 Update 25

Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83218025F0}”

# Uninstall Java 7 Update 67 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F03217067FF}” # Uninstall Java 7 Update 60 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F03217060FF}” # Uninstall Java 7 Update 55 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217055FF}” # Uninstall Java 7 Update 51 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217051FF}” # Uninstall Java 7 Update 45 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217045FF}” # Uninstall Java 7 Update 40 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217040FF}” # Uninstall Java 7 Update 25 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217025FF}” # Uninstall Java 7 Update 21 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217021FF}” # Uninstall Java 7 Update 17 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217017FF}” # Uninstall Java 7 Update 16 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217016FF}” # Uninstall Java 7 Update 15 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217015FF}” # Uninstall Java 7 Update 14 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217014FF}” # Uninstall Java 7 Update 13 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217013FF}” # Uninstall Java 7 Update 12 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217012FF}” # Uninstall Java 7 Update 11 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217011FF}” # Uninstall Java 7 Update 10 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217010FF}” # Uninstall Java 7 Update 9 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217009FF}” # Uninstall Java 7 Update 8 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217008FF}” # Uninstall Java 7 Update 7 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217007FF}” # Uninstall Java 7 Update 6 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217006FF}” # Uninstall Java 7 Update 5 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217005FF}” # Uninstall Java 7 Update 4 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217004FF}” # Uninstall Java 7 Update 3 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217003FF}” # Uninstall Java 7 Update 2 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217002FF}” # Uninstall Java 7 Update 1 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F83217001FF}”##*=============================================== ##* INSTALLATION ##*=============================================== [string]$installPhase = ‘Installation’##

Execute-MSI -Action Install -Path “jre1.8.0_51.msi” -Arguments “JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 IEXPLORER=1 MOZILLA=1 deployment.security.level=MEDIUM”

##*=============================================== ##* POST-INSTALLATION ##*===============================================

[string]$installPhase = ‘Post-Installation’

## Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name EnableAutoUpdateCheck -Value 0 Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name EnableJavaUpdate -Value 0 Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name NotifyDownload -Value 0

Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name NotifyInstall -Value 0

  ## Display a message at the end of the install #Show-InstallationPrompt -Message “You can customize text to appear at the end of an install or remove it completely for unattended installations.” -ButtonRightText ‘OK’ -Icon Information -NoWait } ElseIf ($deploymentType -ieq ‘Uninstall’) { ##*=============================================== ##* PRE-UNINSTALLATION ##*=============================================== [string]$installPhase = ‘Pre-Uninstallation’## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing #Show-InstallationWelcome -CloseApps ‘iexplore,chrome,firefox,javacpl,javaw’ -CloseAppsCountdown 60## Show Progress Message (with the default message)

Show-InstallationProgress

##

##*=============================================== ##* UNINSTALLATION ##*=============================================== [string]$installPhase = ‘Uninstallation’# # Remove this version of Java # Uninstall Java 8 Update 51 Execute-MSI -Action Uninstall -Path ‘{26A24AE4-039D-4CA4-87B4-2F83218051F0}’##*=============================================== ##* POST-UNINSTALLATION ##*===============================================

[string]$installPhase = ‘Post-Uninstallation’

##
}

##*=============================================== ##* END SCRIPT BODY

##*===============================================

## Call the Exit-Script function to perform final cleanup operations Exit-Script -ExitCode $mainExitCode } Catch { [int32]$mainExitCode = 60001 [string]$mainErrorMessage = “$(Resolve-Error)” Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’ Exit-Script -ExitCode $mainExitCode

}

My app Deploy-Application.ps1 for Java 1.8.51_x64 look like this:

[CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [ValidateSet(‘Install’,’Uninstall’)] [string]$DeploymentType = ‘Install’, [Parameter(Mandatory=$false)] [ValidateSet(‘Interactive’,’Silent’,’NonInteractive’)] [string]$DeployMode = ‘Interactive’, [Parameter(Mandatory=$false)] [switch]$AllowRebootPassThru = $false, [Parameter(Mandatory=$false)] [switch]$TerminalServerMode = $false

)

Try { ## Set the script execution policy for this process Try { Set-ExecutionPolicy -ExecutionPolicy ‘ByPass’ -Scope ‘Process’ -Force -ErrorAction ‘Stop’ } Catch {}##*=============================================== ##* VARIABLE DECLARATION ##*=============================================== ## Variables: Application [string]$appVendor = ‘Oracle’ [string]$appName = ‘Java’ [string]$appVersion = ‘8.51 x64’ [string]$appArch = ” [string]$appLang = ‘EN’ [string]$appRevision = ’01’ [string]$appScriptVersion = ‘1.0.0’ [string]$appScriptDate = ’07/14/2015′

[string]$appScriptAuthor = ‘Per Larsen – http://osddeployment.dk’

##*===============================================##* Do not modify section below

#region DoNotModify

## Variables: Exit Code
[int32]$mainExitCode = 0

## Variables: Script [string]$deployAppScriptFriendlyName = ‘Deploy Application’ [version]$deployAppScriptVersion = [version]’3.6.0′ [string]$deployAppScriptDate = ’03/11/2015′

[hashtable]$deployAppScriptParameters = $psBoundParameters

## Variables: Environment
[string]$scriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent

## Dot source the required App Deploy Toolkit Functions Try { [string]$moduleAppDeployToolkitMain = “$scriptDirectoryAppDeployToolkitAppDeployToolkitMain.ps1” If (-not (Test-Path -Path $moduleAppDeployToolkitMain -PathType Leaf)) { Throw “Module does not exist at the specified location [$moduleAppDeployToolkitMain].” } . $moduleAppDeployToolkitMain } Catch { [int32]$mainExitCode = 1 Write-Error -Message “Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)” -ErrorAction ‘Continue’ Exit $mainExitCode

}

#endregion ##* Do not modify section above ##*=============================================== ##* END VARIABLE DECLARATION

##*===============================================

If ($deploymentType -ine ‘Uninstall’) { ##*=============================================== ##* PRE-INSTALLATION ##*===============================================

[string]$installPhase = ‘Pre-Installation’

## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
Show-InstallationWelcome -CloseApps ‘iexplore,chrome,firefox,javacpl,javaw’

## Show Progress Message (with the default message)
Show-InstallationProgress

## # Remove any previous versions of Java # Uninstall Java 8 Update 51 Execute-MSI -Action Uninstall -Path ‘{26A24AE4-039D-4CA4-87B4-2F86418045F0}’ # Uninstall Java 8 Update 45 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86418040F0}” # Uninstall Java 8 Update 31 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86418031F0}” # Uninstall Java 8 Update 25

Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86418025F0}”

# Uninstall Java 7 Update 67 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F06417067FF}” # Uninstall Java 7 Update 60 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F06417060FF}” # Uninstall Java 7 Update 55 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417055FF}” # Uninstall Java 7 Update 51 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417051FF}” # Uninstall Java 7 Update 45 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417045FF}” # Uninstall Java 7 Update 40 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417040FF}” # Uninstall Java 7 Update 25 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417025FF}” # Uninstall Java 7 Update 21 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417021FF}” # Uninstall Java 7 Update 17 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417017FF}” # Uninstall Java 7 Update 16 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417016FF}” # Uninstall Java 7 Update 15 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417015FF}” # Uninstall Java 7 Update 14 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417014FF}” # Uninstall Java 7 Update 13 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417013FF}” # Uninstall Java 7 Update 12 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417012FF}” # Uninstall Java 7 Update 11 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417011FF}” # Uninstall Java 7 Update 10 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417010FF}” # Uninstall Java 7 Update 9 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417009FF}” # Uninstall Java 7 Update 8 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417008FF}” # Uninstall Java 7 Update 7 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417007FF}” # Uninstall Java 7 Update 6 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417006FF}” # Uninstall Java 7 Update 5 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417005FF}” # Uninstall Java 7 Update 4 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417004FF}” # Uninstall Java 7 Update 3 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417003FF}” # Uninstall Java 7 Update 2 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417002FF}” # Uninstall Java 7 Update 1 Execute-MSI -Action Uninstall -Path “{26A24AE4-039D-4CA4-87B4-2F86417001FF}”##*=============================================== ##* INSTALLATION ##*=============================================== [string]$installPhase = ‘Installation’##

Execute-MSI -Action Install -Path “jre1.8.0_51.msi” -Arguments “JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 IEXPLORER=1 MOZILLA=1 deployment.security.level=MEDIUM”

##*=============================================== ##* POST-INSTALLATION ##*===============================================

[string]$installPhase = ‘Post-Installation’

## Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name EnableAutoUpdateCheck -Value 0 Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name EnableJavaUpdate -Value 0 Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name NotifyDownload -Value 0

Set-RegistryKey -Key ‘HKEY_LOCAL_MACHINESOFTWAREWow6432NodeJavasoftJava UpdatePolicy’ -Name NotifyInstall -Value 0

  ## Display a message at the end of the install #Show-InstallationPrompt -Message “You can customize text to appear at the end of an install or remove it completely for unattended installations.” -ButtonRightText ‘OK’ -Icon Information -NoWait } ElseIf ($deploymentType -ieq ‘Uninstall’) { ##*=============================================== ##* PRE-UNINSTALLATION ##*=============================================== [string]$installPhase = ‘Pre-Uninstallation’## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing #Show-InstallationWelcome -CloseApps ‘iexplore,chrome,firefox,javacpl,javaw’ -CloseAppsCountdown 60## Show Progress Message (with the default message)

Show-InstallationProgress

##

##*=============================================== ##* UNINSTALLATION ##*=============================================== [string]$installPhase = ‘Uninstallation’# # Remove this version of Java # Uninstall Java 8 Update 51 Execute-MSI -Action Uninstall -Path ‘{26A24AE4-039D-4CA4-87B4-2F86418051F0}’##*=============================================== ##* POST-UNINSTALLATION ##*===============================================

[string]$installPhase = ‘Post-Uninstallation’

##
}

##*=============================================== ##* END SCRIPT BODY

##*===============================================

## Call the Exit-Script function to perform final cleanup operations Exit-Script -ExitCode $mainExitCode } Catch { [int32]$mainExitCode = 60001 [string]$mainErrorMessage = “$(Resolve-Error)” Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’ Exit-Script -ExitCode $mainExitCode

}

Related Posts

IT /

Intune – Windows device enrollment restrictions – Cloud First

IT /

How to add “hidden” Windows UWP to Windows Store for Business – Cloud First

IT /

Office 2016 Active Directory-Based activation – Cloud First

‹ New Java 1.8.51 has been released – How to upgrade with psappdeploytoolkit – Mobile-First Cloud-First › New Java 1.8.51 has been released – How to upgrade with psappdeploytoolkit – Mobile-First Cloud-First

Recent Posts

  • Intune – Windows device enrollment restrictions – Cloud First
  • How to add “hidden” Windows UWP to Windows Store for Business – Cloud First
  • Office 2016 Active Directory-Based activation – Cloud First
  • How to deploy Windows Local Experience Packs with Intune – Cloud First
  • Conditional Access for Outlook Web Access (OWA) – Cloud First

Recent Comments

No comments to show.

Archives

  • November 2025
  • October 2025
  • August 2025
  • July 2025
  • June 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • November 2024
  • September 2024
  • July 2024
  • June 2024
  • March 2024
  • December 2023
  • August 2023
  • June 2023
  • March 2023
  • February 2023
  • December 2022
  • September 2022
  • August 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • January 2022
  • December 2021
  • October 2021
  • September 2021
  • August 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • February 2020
  • January 2020
  • December 2019
  • October 2019
  • September 2019
  • June 2019
  • April 2019
  • March 2019
  • February 2019
  • March 2018
  • February 2018
  • December 2017
  • October 2017
  • August 2017

Categories

  • IT

Back to Top

© maciejrebisz.com 2026
Powered by WordPress • Themify WordPress Themes