Java version 8 Update 25 package not working with SCCM with Powershell appdeploy toolkit

Topics: Archive - Deployment Scripts
Dec 9, 2014 at 5:09 AM
Edited Dec 9, 2014 at 5:11 AM
Hi

I have crated a package to remove all old version of Java and install Java 8 Update 25.
This package is working fine when I am running this locally but when I am using it via SCCM it fails.

This is script which i am using

<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).  
.DESCRIPTION
The script is provided as a template to perform an install or uninstall of an application(s). 
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down in to 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
To access the help section,
.EXAMPLE
Deploy-Application.ps1
.EXAMPLE
Deploy-Application.ps1 -DeployMode "Silent"
.EXAMPLE
Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
.EXAMPLE
Deploy-Application.ps1 Uninstall 
.PARAMETER DeploymentType
The type of deployment to perform. [Default is "Install"]
.PARAMETER DeployMode
Specifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
Interactive = Default mode
Silent = No dialogs
NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
.PARAMETER AllowRebootPassThru
Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation.
If 3010 is passed back to SCCM a reboot prompt will be triggered. 
.PARAMETER TerminalServerMode
Changes to user install mode and back to user execute mode for installing/uninstalling applications on Remote Destkop Session Host/Citrix servers
.NOTES
.LINK
Http://psappdeploytoolkit.codeplex.com
"#>
Param (
[ValidateSet("Install","Uninstall")] 
[string] $DeploymentType = "Install",
[ValidateSet("Interactive","Silent","NonInteractive")]
[string] $DeployMode = "Interactive",
[switch] $AllowRebootPassThru = $false,
[switch] $TerminalServerMode = $false
)

*===============================================

* VARIABLE DECLARATION

Try {

*===============================================

*===============================================

Variables: Application

$appVendor = "Oracle"
$appName = "Java"
$appVersion = "8u25"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "09/12/2014"
$appScriptAuthor = "Ausaf"

*===============================================

Variables: Script - Do not modify this section

$deployAppScriptFriendlyName = "Deploy Application"
$deployAppScriptVersion = [version]"3.2.0"
$deployAppScriptDate = "09/01/2014"
$deployAppScriptParameters = $psBoundParameters

Variables: Environment

$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition

Dot source the App Deploy Toolkit Functions

."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"

Handle ServiceUI invocation

If ($serviceUIExitCode -ne $null) { Exit-Script $serviceUIExitCode }

*===============================================

* END VARIABLE DECLARATION

*===============================================

*===============================================

* PRE-INSTALLATION

If ($deploymentType -ne "uninstall") { $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" -CloseAppsCountdown "1800" -BlockExecution  -CheckDiskSpace -PersistPrompt

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

*===============================================

* INSTALLATION

$installPhase = "Installation"

*===============================================

# Perform installation tasks here
Remove-MSIApplications "Java"
Execute-Process -FilePath "jre-8u25-windows-i586.exe" -Arguments "/s AUTO_UPDATE=Disable"

*===============================================

* POST-INSTALLATION

$installPhase = "Post-Installation"

*===============================================

# Perform post-installation tasks here

# Display a message at the end of the install
#Show-InstallationPrompt -Message "You can customise text to appear at the end of an install, or remove it completely for unattended installations." -ButtonRightText "Ok" -Icon Information -NoWait

*===============================================

* PRE-UNINSTALLATION

} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Pre-Uninstallation"

*===============================================

# Show Welcome Message, close Internet Explorer if required with a 60 second countdown before automatically closing
Show-InstallationWelcome -CloseApps "iexplore" -CloseAppsCountdown "60"

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

*===============================================

* UNINSTALLATION

$installPhase = "Uninstallation"

*===============================================

# Perform uninstallation tasks here

*===============================================

* POST-UNINSTALLATION

$installPhase = "Post-Uninstallation"

*===============================================

# Perform post-uninstallation tasks here

*===============================================

* END SCRIPT BODY

} } Catch { $exceptionMessage = "$($_.Exception.Message) ($($_.ScriptStackTrace))"; If (!($appDeployToolkitName)) {Throw "Failed to dot-source AppDeployToolkitMain.ps1 - please check if the file is present in the \AppDeployToolkit folder"; Exit 1}
Else { Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1 } } # Catch any errors in this script
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations

*===============================================

Please suggest what could be the reason for this.

When this package runs via sccm i am getting this error

[Installation] :: Executing [C:\WINDOWS\ccmcache\1s\Files\jre-8u25-windows-i586.exe /s AUTO_UPDATE=Disable WEB_JAVA=1 /L C:\Windows\Logs\Software\javas8_25_setup.log]...
Installation] :: Execution failed with exit code [1619]
[Installation] :: Oracle_Java_8Update25_EN_01 Installation completed with exit code [1619].
Dec 9, 2014 at 12:55 PM
Check execmgr.log on the client , this should probably give you a heads up why it won't install.
Dec 10, 2014 at 6:44 AM
Hi Stian

I have changed my script and now i am using msi file instead of exe

After that its working fine


[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 = '8U25'
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.0'
[string]$appScriptDate = '09/12/2014'
[string]$appScriptAuthor = 'Ausaf'
##*===============================================

##* Do not modify section below
#region DoNotModify

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

## Variables: Script
[string]$deployAppScriptFriendlyName = 'Deploy Application'
[version]$deployAppScriptVersion = [version]'3.5.0'
[string]$deployAppScriptDate = '11/17/2014'
[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 = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.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-Output "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message) `n$($_.InvocationInfo.PositionMessage)"
    Exit $mainExitCode
}

## Handle ServiceUI Invocation
If ($serviceUIExitCode) { Exit-Script -ExitCode $serviceUIExitCode }

#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,jp2launcher' -ForceCloseAppsCountdown 1800 -CheckDiskSpace -PersistPrompt

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

    ## <Perform Pre-Installation tasks here>

    ##*===============================================
    ##* INSTALLATION 
    ##*===============================================
    [string]$installPhase = 'Installation'

    ## <Perform Installation tasks here>
    Write-Log -Message "Installing Java 8 Update 25"
    Execute-MSI -Action Install -Path 'jre1.8.0_25.msi' -Parameters '/QN STATIC=1 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=M'

    ##*===============================================
    ##* POST-INSTALLATION
    ##*===============================================
    [string]$installPhase = 'Post-Installation'

    ## <Perform Post-Installation tasks here>
    Write-Log -Message "Uninstalling old version of Java"
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216030FF}'
    Execute-MSI -Action Uninstall -Path  '{0E65518E-EC48-11D6-88B8-0050DA21757E}'
    Execute-MSI -Action Uninstall -Path  '{7148F0A8-6813-11D6-A77B-00B0D0142090}'
    Execute-MSI -Action Uninstall -Path  '{7148F0A8-6813-11D6-A77B-00B0D0142130}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217011FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217013FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217017FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217021FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217025FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217040FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217045FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217051FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217055FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F03217060FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F03217065FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F03217067FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217007FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F03217071FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217009FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83218011FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83218020F0}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83218005FF}'
    Execute-MSI -Action Uninstall -Path  '{4A03706F-666A-4037-7777-5F2748764D10}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216020FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216020F0}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216022FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216022F0}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216023F0}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216024FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216024F0}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216025FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216027FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216029FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216026FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216031FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216032FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216034FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216037FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216038FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216043FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83216045FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217004FF}'
    Execute-MSI -Action Uninstall -Path  '{26A24AE4-039D-4CA4-87B4-2F83217005FF}'



    ## 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' -CloseAppsCountdown 60

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

    ## <Perform Pre-Uninstallation tasks here>


    ##*=========================================
Dec 10, 2014 at 6:46 AM
Edited Dec 10, 2014 at 6:46 AM
I have followed steps mentioned in this link to fix this

How to install Java via SCCM 2012
Dec 17, 2014 at 4:17 PM
try using this;

Execute-MSI -Action Install -Path "$dirFiles\jre1.8.0_25.msi"