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
This is my attempt to post things that I have encountered, found little or incomplete information for, and hope to be able to help others with. Topics will be Information Technology centric with most dealing with Microsoft System Center. The concept of a jumpbag is to contain all the things you need to survive most situations.
Tuesday, November 16, 2010
Exchange script in Task Scheduler
Want to run an Exchange script on a schedule? For example, the script I posted to remove all items in the Deleted Items folder that are more than 30 days old. If you are running an Exchange CCR, this should be done on a separate role from the mailbox nodes.
First you will have to add a line to the script so that it will know which domain controller to use. Add these lines below and replace FQDN with that of your own domain controller.
#Sets the Exchange Server to use a specific domain controller.
Set-ExchangeServer -DomainController FQDN
In Windows Server 2008, open the Task Scheduler and create a new task.
Give it a Name and Description
Set the user to run under which should probably be one with Exchange Admin rights.
Check Run whether user is logged on or not
Set your schedule on the Triggers tab such as when you want it to run.
For the Action select Start a Program
I created a batch file with this line. This will call Powershell with the Exchange extensions and then feed in the script we created for deleting items.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'"; ". 'C:\Scripts\DeletedItems30Days.ps1'"
Program/script: Powershell.exe
Add arguments: -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\ExShell.Psc1" -Command ". 'C:\Scripts\DeletedItems30Days.ps1'"
Set any Conditions and Settings and press OK.
I get a nice little email every Friday evening with a list of all accounts, the number of items deleted and the amount of space removed from each account, then totals of each at the bottom.
First you will have to add a line to the script so that it will know which domain controller to use. Add these lines below and replace FQDN with that of your own domain controller.
#Sets the Exchange Server to use a specific domain controller.
Set-ExchangeServer -DomainController FQDN
In Windows Server 2008, open the Task Scheduler and create a new task.
Give it a Name and Description
Set the user to run under which should probably be one with Exchange Admin rights.
Check Run whether user is logged on or not
Set your schedule on the Triggers tab such as when you want it to run.
For the Action select Start a Program
I created a batch file with this line. This will call Powershell with the Exchange extensions and then feed in the script we created for deleting items.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'"; ". 'C:\Scripts\DeletedItems30Days.ps1'"
Program/script: Powershell.exe
Add arguments: -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\ExShell.Psc1" -Command ". 'C:\Scripts\DeletedItems30Days.ps1'"
Set any Conditions and Settings and press OK.
I get a nice little email every Friday evening with a list of all accounts, the number of items deleted and the amount of space removed from each account, then totals of each at the bottom.
Subscribe to:
Posts (Atom)