Tuesday, November 16, 2010

Java 6 Update 22 partial installs

I went to push out Java 6 Update 22 with SCCM found that the MSI no longer works and was reporting a success even though it hadn't fully installed.  Sun decided to make the install a multi-part install and the MSI that we used to extract is only part of the application.  This left me with several machines with half of a working Java install but a successful report back from almost all of them.

I did some searching and found that supposedly you could pass the old MSI arguments to the jre-6u22-windows-i586-s.exe and gave that a try only to find that they didn't work.  Guess I should have known that one ahead of time.  In testing and troubleshooting I found that some of the Java 6 U 22 installs wouldn't even uninstall.  So I came up with a quick and dirty little script that removes the files and registry keys and then reinstalls the full package.  I will walk you through each of these steps.  Each of the files is pasted below and separated by ===.

I created 2 SCCM programs under the Sun Java Package.  1. is the uninstall and 2. is the reinstall.  One advertisement for all of it calls the uninstall program first and then the reinstall command line.

Uninstall:
The first thing we do is stop the jqs, copy over the vbs that does the uninstall of lots of previous packages and run it.  Then we remove the registry keys and java folders for Update22.  At the end we delete the uninstall.vbs.

Uninstall.bat
========================================================

net stop "java quick starter"

c:
cd\
copy \\sccmserver\fileshare\javauninstall.vbs c:\
javauninstall.vbs

reg delete "HKEY_CLASSES_ROOT\Installer\Products\4EA42A62D9304AC4784BF238120622FF" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4EA42A62D9304AC4784BF238120622FF" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216022FF}" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\JreMetrics" /f

rd "%programfiles%\java" /s /q
rd "%programfiles% (x86)\java" /s /q

del c:\javauninstall.vbs
=========================================================

javauninstall.vbs
=========================================================

Set objWshShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next

' Java(TM) 6 Update 21 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216021FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216021F0} /qn", 1, True

' Java(TM) 6 Update 20 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216020FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216020F0} /qn", 1, True

' Java(TM) 6 Update 19 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216019FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216019F0} /qn", 1, True

' Java(TM) 6 Update 18 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216018FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216018F0} /qn", 1, True

' Java(TM) 6 Update 17 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216017FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216017F0} /qn", 1, True

' Java(TM) 6 Update 16 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216016FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216016F0} /qn", 1, True

' Java(TM) 6 Update 15 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216015FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216015F0} /qn", 1, True

' Java(TM) 6 Update 14 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216014FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216014F0} /qn", 1, True

' Java(TM) 6 Update 13 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216013FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216013F0} /qn", 1, True

' Java(TM) 6 Update 12 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216012FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216012F0} /qn", 1, True

' Java(TM) 6 Update 11 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216011FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216011F0} /qn", 1, True

' Java(TM) 6 Update 10 removal.
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216010FF} /qn", 1, True
objWshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216010F0} /qn", 1, True

' Java(TM) 6 Update 7 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160070} /qn", 1, True

' Java(TM) 6 Update 6 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160060} /qn", 1, True

' Java(TM) 6 Update 5 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160050} /qn", 1, True

' Java(TM) 6 Update 4 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160040} /qn", 1, True

' Java(TM) 6 Update 3 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160030} /qn", 1, True

' Java(TM) 6 Update 2 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160020} /qn", 1, True

' Java(TM) 6 Update 1 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160010} /qn", 1, True

' Java(TM) 6 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160000} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 12 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150120} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 11 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150110} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 10 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150100} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 9 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150090} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 6 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150060} /qn", 1, True

' J2SE Runtime Environment 5.0 Update 4 removal.
objWshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150040} /qn", 1, True

wscript.quit
================================================================

Reinstall program:
Put this as your Command Line: jre-6u22-windows-i586-s.exe /quiet /norestart
There are other arguments you can pass too but I wanted quick and dirty to get these machines functional again.
Run whether a user is logged in or not and with administrative rights.
Run the uninstall first and always run it first.
Suppress program notifications.
And then advertise it.

This successfully pushed out Java 6 Update 22 to almost all of my machines.  A friend of mine has published a script that does this more cleanly by first determining if the machine is x86 or x64.  You can find that article and his SCCM MVP blog here: http://sms-hints-tricks.blogspot.com/2010/11/i-was-getting-tired-of-some-of-problems.html

1 comment:

  1. Thanks! I was looking for some information and this was very useful for me.

    ReplyDelete