Jump to content


firstcom

Java 8 Install

Recommended Posts

Good morning all,

 

Can I get some detailed feedback on how folks deploy Java 8 updates? I've got mine set up as an application with supersedence rules to remove old versions. However, the new install often errors out with code 1603.

 

I'm trying to deploy Java 8 Update 65.

 

The install works fine when msiexec is called from the local command line on the PCs, but not when it's deployed from SCCM. It's set up to run as Administrator, etc. The command line I'm using is:

 

msiexec /i "jre1.8.0_65.msi" AUTO_UPDATE=0 EULA=0 NOSTARTMENU=1 SPONSORS=0 WEB_ANALYTICS=0 WEB_JAVA=1 WEB_JAVA_SECURITY_LEVEL=H /qb

 

If you're using some kind of script, please share the script. If you somehow managed to get it to install as a simple application configured within SCCM, please share your parameters and details.

 

I'd appreciate any input and assistance that anyone can provide.

 

Thanks all!

Share this post


Link to post
Share on other sites


I have a script that I created (using someones code) to remove ANY other Java version installed... it's powershell, but it's called via CMD script... interested?!

Share this post


Link to post
Share on other sites

I just have a cmd script that runs the following code...it's never failed on me before?

 

msiexec.exe /i "%~dp0jre1.8.0_66.msi" JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No WEB_JAVA=1 /qn

post-32696-0-75993600-1452030539.png

Share this post


Link to post
Share on other sites

I hate Java. It has caused me the biggest headaches when mass deploying. Their installer is utterly S***.

 

When deploying it through SCCM, it gets even worse and as you have said, it throws random errors and is literally random.

 

However, below are the scripts I use which work for me deploying to 10k machines. A lot of blood and tears went into these (even if it is basic) and it's the only way I could get them to work. These use a config file aswell (read their website) and puts the exception.sites file in place. It also ensures updates are disabled and start menu cleaned. These are for x86 version so mirror for x64 also changing relevant parts.

 

This script should only be run when no versions of Java are installed:

@ECHO OFF
REM Red Wedding
taskkill /F /IM javaw.exe
taskkill /F /IM jqs.exe
taskkill /F /IM jusched.exe
del "C:\Program Files (x86)\Common Files\Java" /S /F /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f

REM Copy Config File Locally and Rename
XCOPY "%~dp0Config.cfg" "%systemdrive%\ProgramData\Oracle\Java\java.settings.cfg*" /R /H /Y

REM Install Java
msiexec /i "%~dp0jre1.8.0_60.msi" INSTALLCFG="%~dp0Config.cfg" REPAIRMODE=0 AUTO_UPDATE=0 EULA=0 INSTALL_SILENT=1 NOSTARTMENU=1 SPONSORS=0 /q /L C:\apps\java86.txt

REM Create Dir Structure
MD "%systemroot%\Sun\Java\Deployment\"

REM Copy Config Files
XCOPY "%~dp0deployment.config" "%systemroot%\Sun\Java\Deployment\deployment.config*" /R /H /Y
XCOPY "%~dp0deployment.properties" "%systemroot%\Sun\Java\Deployment\deployment.properties*" /R /H /Y

REM Copy Site Exceptions
xCOPY "\\SERVERSHARE\Java\exceptionsites\exception.sites" "%systemroot%\Sun\Java\Deployment\exception.sites*" /R /H /Y

REM Disable Updates Completely
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /f /v EnableJavaUpdate /t REG_DWORD /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v AUTOUPDATECHECK /t REG_SZ /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v JAVAUPDATE /t REG_SZ /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v JU /t REG_SZ /d 0

REM Cleanup
RD "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Java\" /S /Q
del "C:\Program Files (x86)\Common Files\Java" /S /F /Q

I also found, that should there even be a trace of Java on the machine, then installing via SCCM will fail. So I made the below scripts to kill Java.

 

Java 6 and below:

wmic product where "name like 'Java(TM)%%'" call uninstall /nointeractive

RD "C:\Program Files\Java\jre6" /S /Q
RD "C:\Program Files (x86)\Java\jre6" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" /f

Exit /B 0

Java 7:

wmic product where "name like 'Java 7%%'" call uninstall /nointeractive

RD "C:\Program Files\Java\jre7" /S /Q
RD "C:\Program Files (x86)\Java\jre7" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" /f

Exit /B 0

Java Completely

wmic product where "name like 'Java%%'" call uninstall /nointeractive

RD "C:\Program Files\Java" /S /Q
RD "C:\Program Files (x86)\Java" /S /Q
RD "C:\ProgramData\Java" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft" /f
RD "%systemroot%\Sun\Java\Deployment\" /S /Q
RD "%systemdrive%\Microsoft\Windows\Start Menu\Programs\Java\" /S /Q
RD "%systemdrive%\ProgramData\Oracle\" /S /Q

Exit /B 0

Hope they help.

 

Rich Mawdsley

Share this post


Link to post
Share on other sites

Where do you get the MSI from? From the Oracle or some other source?

 

Regular offline installer exe. Run it, click past UAC prompt, and then stop.

Look in %appdata%\LocalLow\Oracle\Java\ - there'll be subfolders for whatever version(s) you're dealing with. MSIs are in there.

Replace Oracle with Sun if you're dealing with older versions (8u45 and earlier, 7u...??? everything? haven't messed with the final builds).

Share this post


Link to post
Share on other sites

 

Regular offline installer exe. Run it, click past UAC prompt, and then stop.

Look in %appdata%\LocalLow\Oracle\Java\ - there'll be subfolders for whatever version(s) you're dealing with. MSIs are in there.

Replace Oracle with Sun if you're dealing with older versions (8u45 and earlier, 7u...??? everything? haven't messed with the final builds).

Hey Jaybone,

Thanks for the update! I read somewhere that this MSI accepts Oracle switches (not the tradicional ones). True? Like /quiet is different?

 

And again, thanks!

Share this post


Link to post
Share on other sites

Yes please!

 

 

I have a script that I created (using someones code) to remove ANY other Java version installed... it's powershell, but it's called via CMD script... interested?!

Share this post


Link to post
Share on other sites

I already get the MSIs from the executables. That's what I use...

 

 

Hey Jaybone,

Thanks for the update! I read somewhere that this MSI accepts Oracle switches (not the tradicional ones). True? Like /quiet is different?

 

And again, thanks!

 

 

Regular offline installer exe. Run it, click past UAC prompt, and then stop.

Look in %appdata%\LocalLow\Oracle\Java\ - there'll be subfolders for whatever version(s) you're dealing with. MSIs are in there.

Replace Oracle with Sun if you're dealing with older versions (8u45 and earlier, 7u...??? everything? haven't messed with the final builds).

Share this post


Link to post
Share on other sites

I'm using this "AS" a removal:

 

filename removal.cmd:

 

 

@start /wait /min %WINDIR%\System32\WindowsPowerShell\v1.0\Powershell.exe -noprofile -executionpolicy bypass -file %~dp0uninstall.ps1

 

filename uninstall.ps1

 

 

$javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |

Get-ItemProperty |
Where-Object {$_.DisplayName -match "java" } |
Select-Object -Property DisplayName, UninstallString
$MSISwitch = "/qn"
ForEach ($ver in $javaVer) {
If ($ver.UninstallString) {
$UninstGUID = ($ver.UninstallString -replace ".*{", "") -replace "}.*", ""
Start-Process -filepath "C:\Windows\system32\msiexec.exe" -argumentlist "/x{$UninstGUID}", $MSISwitch -passthru -wait
Write-Host Start-Process -filepath "C:\Windows\system32\msiexec.exe" -argumentlist "/x{$UninstGUID}", $MSISwitch -passthru -wait
}
}
Write-Host Done!

 

Like I said - Any installed Java will be removed. Use this on package or as an application removal script. Let me know if it works for you as it works for me! :)

Share this post


Link to post
Share on other sites

Be careful with that one - looks like it'll get Java-related stuff, as well.

 

E.g. "Visual Studio Extensions for Windows Library for JavaScript" gets caught by that.

 

Also won't get 32-bit installs on a 64-bit OS, since those live in hklm\wow6432node\microsoft\...

Share this post


Link to post
Share on other sites

How do you handle Java deployments/upgrades?

 

Be careful with that one - looks like it'll get Java-related stuff, as well.

 

E.g. "Visual Studio Extensions for Windows Library for JavaScript" gets caught by that.

 

Also won't get 32-bit installs on a 64-bit OS, since those live in hklm\wow6432node\microsoft\...

Share this post


Link to post
Share on other sites

How do you handle Java deployments/upgrades?

 

I also agree that uninstalling anything with "Java%" in its name is dangerous.

 

I prefer instead to run a query that brings back the Java products installed as well as the uninstall string for them. I then create a script that contains all these uninstall strings. A tad bit extra work but safer than removing all Java items on your machine.

Share this post


Link to post
Share on other sites

Yes, this script was made only for x64, but you can use for x86 as well... Just change the location where the uninstall strings are for x86.

 

Regarding other products that might used similar name (like "java") you can always add a second name that probably won't be found in other products. To test the script without executing the removal, just output the installations:

 

 

$javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |

Get-ItemProperty |
Where-Object {$_.DisplayName -match "java JRE" } |
Select-Object -Property DisplayName, UninstallString
$MSISwitch = "/qn"
ForEach ($ver in $javaVer) {
If ($ver.UninstallString) {
write-host $ver $javaVer
}
}

Share this post


Link to post
Share on other sites

With the answers so far I've read various solutions but nothing that stands out to me as a consistent and concrete deployment method. I'd love to hear details from others on how they deploy Java.

Share this post


Link to post
Share on other sites

Seems like you are hard to please.

 

Well you can give this a try. This is my script for the 32Bit Runtime. It uninstalls every 32Bit Version of JRE 7 & 8 (not 6 for a specific reason in our case).

It also creates a unique named hardlink for the Insallation directory under program files (request by our developers). It installs our internal certificates (Active Directory, etc), cleans up the user java cache directories (some applications will act up otherwise) and finally sets some global deployment properties for all users.

 

It also skips the whole Installation i any Java process is open (we have some critical applications which might suffer a data loss otherwise).

$VersionString = "jre1.8.0_65"

$ExitCode = 0
$myPath = Split-Path $script:MyInvocation.MyCommand.Path
Set-Location $myPath

$Process = (Get-Process 'java','javaw','javaws','javacpl' -ErrorAction SilentlyContinue -FileVersionInfo)
if ($Process){
	$ExitCode = 222
}
else {
    gwmi -Namespace root\cimv2\SMS -Class SMS_installedSoftware -Filter "ProductName Like '%Java 7 Update%' And Not ProductName Like '%Kit%' And Not ProductName Like '%64-bit%' " -Property SoftwareCode,ProductName | ForEach-Object { 
        $myArgs = "/X" + $_.SoftwareCode + " /norestart /q"
        $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
    }

    gwmi -Namespace root\cimv2\SMS -Class SMS_installedSoftware -Filter "ProductName Like '%Java 8 Update%' And Not ProductName Like '%Kit%' And Not ProductName Like '%64-bit%' " -Property SoftwareCode,ProductName | ForEach-Object { 
        $myArgs = "/X" + $_.SoftwareCode + " /norestart /q"
        $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
    }
    if(Test-Path 'C:\Program Files (x86)'){
        c:\windows\system32\cmd.exe /C rd 'C:\Program Files (x86)\Java\jre8' /Q
    }
    else {
        c:\windows\system32\cmd.exe /C rd 'C:\Program Files\Java\jre8' /Q
    }
    Start-Sleep 30
    $myArgs = "/i """ + $myPath + "\$VersionString.msi"" AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 SYSTRAY=1 /norestart /q"
    $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
	$Users = Get-ChildItem -Path "c:\Users"

 	$str1 = "-importcert -trustcacerts -keystore "
    $str3 = "\Java\jre8\lib\security\cacerts"" -file cert1.cer -alias cert1 -storepass changeit -noprompt"
    $str4 = "\Java\jre8\lib\security\cacerts"" -file cert2.cer -alias cert2 -storepass changeit -noprompt"
    $str5 = "\Java\jre8\lib\security\cacerts"" -file cert3.cer -alias cert3 -storepass changeit -noprompt"

    If ( Test-Path 'C:\Program Files (x86)'){
        $str2 = "C:\Program Files (x86)"
        cmd.exe /C "mklink /J ""C:\Program Files (x86)\Java\jre8"" ""C:\Program Files (x86)\Java\$VersionString"""
    }
    else {
        $str2 = "C:\Program Files"
        cmd.exe /C "mklink /J ""C:\Program Files\Java\jre8"" ""C:\Program Files\Java\$VersionString"""
    }
    $argString = $str1 + """" + $str2 + $str3
    $argString1 = $str1 + """" + $str2 + $str4
    $argString2 = $str1 + """" + $str2 + $str5
    
    $comString = $str2 + "\Java\jre8\bin\keytool.exe"
    if(Test-Path "$comString"){
        Start-Process -FilePath "$comString" -ArgumentList $argString -Wait -Passthru -NoNewWindow
 	    Start-Process -FilePath "$comString" -ArgumentList $argString1 -Wait -Passthru -NoNewWindow
 	    Start-Process -FilePath "$comString" -ArgumentList $argString2 -Wait -Passthru -NoNewWindow
    }

	foreach ($User in $Users){
		$myPath = Join-Path -Path "C:\Users" -ChildPath $User
		$Path1 = Join-Path -Path $myPath -ChildPath "AppData\LocalLow\Sun\Java\Deployment\cache"
		If ( Test-Path $Path1 ) {
			Remove-Item -Path $Path1 -Recurse -Force -ErrorAction SilentlyContinue
		}
	}
    Remove-Item -Force -Path "$env:ALLUSERSPROFILE\microsoft\windows\start menu\programs\java" -recurse -ErrorAction SilentlyContinue
    New-Item -force -Path "$env:windir\Sun\Java\Deployment\deployment.properties" -ItemType file -ErrorAction SilentlyContinue
    New-Item -force -Path "$env:windir\Sun\Java\Deployment\deployment.config" -ItemType file -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.config" -value "deployment.system.config.mandatory=true" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.config" -value "deployment.system.config=file:///$env:SystemDrive/Windows/Sun/Java/Deployment/deployment.properties" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.expiration.check.enabled=false" -ErrorAction SilentlyContinue 
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.mixcode=HIDE_RUN" -ErrorAction SilentlyContinue 
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.level=HIGH" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.level.unlocked" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.insecure.jres=NEVER" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.javaws.shortcut=NEVER" -ErrorAction SilentlyContinue  
}
[Environment]::Exit($ExitCode)


Share this post


Link to post
Share on other sites

With the answers so far I've read various solutions but nothing that stands out to me as a consistent and concrete deployment method. I'd love to hear details from others on how they deploy Java.

 

Firstcom,

 

My honest answer... SCCM is not a standard product (like Exchange, or SQL or as HyperV). It's a product that helps you to automate your IT processes and deliver dynamic solutions based on your needs. This also means that there aren't perfect nor ideal solutions for each thing that we configured in the SCCM. My way can be different from others, but it serves my propose, but might not work for you or others. That's the thing about this product - everything can be wrong and right - because it's about outcome that you want to achieve. Example: you might use one single WIM to deliver your images or you might use 10 based on vary different aspects. It all depends! I hope you can find more solutions with for your Java or you can simply use applications and supersede older versions (if you have a MSI).

Share this post


Link to post
Share on other sites

Thank you! This script/method looks pretty solid. I'll give this a shot. Do you run into errors during Java installation? That's the issue I've been having -- occasional errors/failures during installs.

 

 

 

Seems like you are hard to please.

 

Well you can give this a try. This is my script for the 32Bit Runtime. It uninstalls every 32Bit Version of JRE 7 & 8 (not 6 for a specific reason in our case).

It also creates a unique named hardlink for the Insallation directory under program files (request by our developers). It installs our internal certificates (Active Directory, etc), cleans up the user java cache directories (some applications will act up otherwise) and finally sets some global deployment properties for all users.

 

It also skips the whole Installation i any Java process is open (we have some critical applications which might suffer a data loss otherwise).

$VersionString = "jre1.8.0_65"

$ExitCode = 0
$myPath = Split-Path $script:MyInvocation.MyCommand.Path
Set-Location $myPath

$Process = (Get-Process 'java','javaw','javaws','javacpl' -ErrorAction SilentlyContinue -FileVersionInfo)
if ($Process){
	$ExitCode = 222
}
else {
    gwmi -Namespace root\cimv2\SMS -Class SMS_installedSoftware -Filter "ProductName Like '%Java 7 Update%' And Not ProductName Like '%Kit%' And Not ProductName Like '%64-bit%' " -Property SoftwareCode,ProductName | ForEach-Object { 
        $myArgs = "/X" + $_.SoftwareCode + " /norestart /q"
        $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
    }

    gwmi -Namespace root\cimv2\SMS -Class SMS_installedSoftware -Filter "ProductName Like '%Java 8 Update%' And Not ProductName Like '%Kit%' And Not ProductName Like '%64-bit%' " -Property SoftwareCode,ProductName | ForEach-Object { 
        $myArgs = "/X" + $_.SoftwareCode + " /norestart /q"
        $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
    }
    if(Test-Path 'C:\Program Files (x86)'){
        c:\windows\system32\cmd.exe /C rd 'C:\Program Files (x86)\Java\jre8' /Q
    }
    else {
        c:\windows\system32\cmd.exe /C rd 'C:\Program Files\Java\jre8' /Q
    }
    Start-Sleep 30
    $myArgs = "/i """ + $myPath + "\$VersionString.msi"" AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 SYSTRAY=1 /norestart /q"
    $ExitCode = (Start-Process -FilePath "msiexec.exe" -ArgumentList $myArgs -ErrorAction SilentlyContinue -NoNewWindow -Wait -PassThru).ExitCode
	$Users = Get-ChildItem -Path "c:\Users"

 	$str1 = "-importcert -trustcacerts -keystore "
    $str3 = "\Java\jre8\lib\security\cacerts"" -file cert1.cer -alias cert1 -storepass changeit -noprompt"
    $str4 = "\Java\jre8\lib\security\cacerts"" -file cert2.cer -alias cert2 -storepass changeit -noprompt"
    $str5 = "\Java\jre8\lib\security\cacerts"" -file cert3.cer -alias cert3 -storepass changeit -noprompt"

    If ( Test-Path 'C:\Program Files (x86)'){
        $str2 = "C:\Program Files (x86)"
        cmd.exe /C "mklink /J ""C:\Program Files (x86)\Java\jre8"" ""C:\Program Files (x86)\Java\$VersionString"""
    }
    else {
        $str2 = "C:\Program Files"
        cmd.exe /C "mklink /J ""C:\Program Files\Java\jre8"" ""C:\Program Files\Java\$VersionString"""
    }
    $argString = $str1 + """" + $str2 + $str3
    $argString1 = $str1 + """" + $str2 + $str4
    $argString2 = $str1 + """" + $str2 + $str5
    
    $comString = $str2 + "\Java\jre8\bin\keytool.exe"
    if(Test-Path "$comString"){
        Start-Process -FilePath "$comString" -ArgumentList $argString -Wait -Passthru -NoNewWindow
 	    Start-Process -FilePath "$comString" -ArgumentList $argString1 -Wait -Passthru -NoNewWindow
 	    Start-Process -FilePath "$comString" -ArgumentList $argString2 -Wait -Passthru -NoNewWindow
    }

	foreach ($User in $Users){
		$myPath = Join-Path -Path "C:\Users" -ChildPath $User
		$Path1 = Join-Path -Path $myPath -ChildPath "AppData\LocalLow\Sun\Java\Deployment\cache"
		If ( Test-Path $Path1 ) {
			Remove-Item -Path $Path1 -Recurse -Force -ErrorAction SilentlyContinue
		}
	}
    Remove-Item -Force -Path "$env:ALLUSERSPROFILE\microsoft\windows\start menu\programs\java" -recurse -ErrorAction SilentlyContinue
    New-Item -force -Path "$env:windir\Sun\Java\Deployment\deployment.properties" -ItemType file -ErrorAction SilentlyContinue
    New-Item -force -Path "$env:windir\Sun\Java\Deployment\deployment.config" -ItemType file -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.config" -value "deployment.system.config.mandatory=true" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.config" -value "deployment.system.config=file:///$env:SystemDrive/Windows/Sun/Java/Deployment/deployment.properties" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.expiration.check.enabled=false" -ErrorAction SilentlyContinue 
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.mixcode=HIDE_RUN" -ErrorAction SilentlyContinue 
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.level=HIGH" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.security.level.unlocked" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.insecure.jres=NEVER" -ErrorAction SilentlyContinue
    Add-Content -path "$env:windir\Sun\Java\Deployment\deployment.properties" -value "deployment.javaws.shortcut=NEVER" -ErrorAction SilentlyContinue  
}
[Environment]::Exit($ExitCode)


Share this post


Link to post
Share on other sites

I hate Java. It has caused me the biggest headaches when mass deploying. Their installer is utterly S***.

 

When deploying it through SCCM, it gets even worse and as you have said, it throws random errors and is literally random.

 

However, below are the scripts I use which work for me deploying to 10k machines. A lot of blood and tears went into these (even if it is basic) and it's the only way I could get them to work. These use a config file aswell (read their website) and puts the exception.sites file in place. It also ensures updates are disabled and start menu cleaned. These are for x86 version so mirror for x64 also changing relevant parts.

 

This script should only be run when no versions of Java are installed:

@ECHO OFF
REM Red Wedding
taskkill /F /IM javaw.exe
taskkill /F /IM jqs.exe
taskkill /F /IM jusched.exe
del "C:\Program Files (x86)\Common Files\Java" /S /F /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f

REM Copy Config File Locally and Rename
XCOPY "%~dp0Config.cfg" "%systemdrive%\ProgramData\Oracle\Java\java.settings.cfg*" /R /H /Y

REM Install Java
msiexec /i "%~dp0jre1.8.0_60.msi" INSTALLCFG="%~dp0Config.cfg" REPAIRMODE=0 AUTO_UPDATE=0 EULA=0 INSTALL_SILENT=1 NOSTARTMENU=1 SPONSORS=0 /q /L C:\apps\java86.txt

REM Create Dir Structure
MD "%systemroot%\Sun\Java\Deployment\"

REM Copy Config Files
XCOPY "%~dp0deployment.config" "%systemroot%\Sun\Java\Deployment\deployment.config*" /R /H /Y
XCOPY "%~dp0deployment.properties" "%systemroot%\Sun\Java\Deployment\deployment.properties*" /R /H /Y

REM Copy Site Exceptions
xCOPY "\\SERVERSHARE\Java\exceptionsites\exception.sites" "%systemroot%\Sun\Java\Deployment\exception.sites*" /R /H /Y

REM Disable Updates Completely
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /f /v EnableJavaUpdate /t REG_DWORD /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v AUTOUPDATECHECK /t REG_SZ /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v JAVAUPDATE /t REG_SZ /d 0
REG ADD "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8.0_60\MSI" /f /v JU /t REG_SZ /d 0

REM Cleanup
RD "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Java\" /S /Q
del "C:\Program Files (x86)\Common Files\Java" /S /F /Q

I also found, that should there even be a trace of Java on the machine, then installing via SCCM will fail. So I made the below scripts to kill Java.

 

Java 6 and below:

wmic product where "name like 'Java(TM)%%'" call uninstall /nointeractive

RD "C:\Program Files\Java\jre6" /S /Q
RD "C:\Program Files (x86)\Java\jre6" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" /f

Exit /B 0

Java 7:

wmic product where "name like 'Java 7%%'" call uninstall /nointeractive

RD "C:\Program Files\Java\jre7" /S /Q
RD "C:\Program Files (x86)\Java\jre7" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" /f

Exit /B 0

Java Completely

wmic product where "name like 'Java%%'" call uninstall /nointeractive

RD "C:\Program Files\Java" /S /Q
RD "C:\Program Files (x86)\Java" /S /Q
RD "C:\ProgramData\Java" /S /Q
REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f
REG DELETE "HKLM\SOFTWARE\JavaSoft" /f
RD "%systemroot%\Sun\Java\Deployment\" /S /Q
RD "%systemdrive%\Microsoft\Windows\Start Menu\Programs\Java\" /S /Q
RD "%systemdrive%\ProgramData\Oracle\" /S /Q

Exit /B 0

Hope they help.

 

Rich Mawdsley

I've created a basic script based on yours for Java 8 Update 73 (see below), the deployment fails, in the log file I see the bellow, any idea whats going on? I'm tearing my hair out with this shitty java install.

 

Error

 

MSI (s) (68:3C) [12:44:18:265]: Product: Java 8 Update 73 -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2705. The arguments are: Directory, ,

 

Script

 

@ECHO OFF

REM Kill Java

taskkill /F /IM javaw.exe

taskkill /F /IM jqs.exe

taskkill /F /IM jusched.exe

 

 

REM Remove Java

 

wmic product where "name like 'Java%%'" call uninstall /nointeractive

 

RD "C:\Program Files\Java" /S /Q

RD "C:\Program Files (x86)\Java" /S /Q

RD "C:\ProgramData\Java" /S /Q

REG DELETE "HKLM\SOFTWARE\Wow6432Node\JavaSoft" /f

REG DELETE "HKLM\SOFTWARE\JavaSoft" /f

RD "%systemroot%\Sun\Java\Deployment\" /S /Q

RD "%systemdrive%\Microsoft\Windows\Start Menu\Programs\Java\" /S /Q

RD "%systemdrive%\ProgramData\Oracle\" /S /Q

 

REM Copy Config File and Rename

XCOPY "%~dp0Config.cfg" "%systemdrive%\ProgramData\Oracle\Java\java.settings.cfg*" /R /H /Y

 

 

REM Install Java

msiexec /i "%~dp0jre1.8.0_73.msi" INSTALLCFG="%~dp0Config.cfg" REPAIRMODE=0 AUTO_UPDATE=0 EULA=0 INSTALL_SILENT=1 NOSTARTMENU=0 SPONSORS=0 /q /L C:\win7Software\Java_Install.txt

 

Any help would be much appreciated.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...