Hi all,
I'm looking to find the best way to update java on desktops. Unfortunately if I only run the last java exe/msi version I will have two java versions. I've tried to create a package and push java latest version with a option run a program first witch is a
vb script to uninstall all java versions. Unfortunately vbs script is crushing with sccm. If I run this script manually is working.
Any other approach for this task?
Thanks.
Logs:
Successfully prepared command line "C:\windows\system32\cscript.exe" java-uninstaller.vbs
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Command line = "C:\windows\system32\cscript.exe" java-uninstaller.vbs, Working Directory = C:\windows\system32\
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Created Process for the passed command line
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Raising event:
[SMS_CodePage(850), SMS_LocaleID(6153)]
instance of SoftDistProgramStartedEvent
{
AdvertisementId = "P0120004";
ClientID = "GUID:EA79FDBB-F478-40FC-9598-696EDBF74BA5";
CommandLine = "\"C:\\windows\\system32\\cscript.exe\" java-uninstaller.vbs";
DateTime = "20151202164139.440000+000";
MachineName = "BNW7-20427";
PackageName = "P0100029";
ProcessID = 5072;
ProgramName = "Uninstall Java";
SiteCode = "P01";
ThreadID = 3760;
UserContext = "NT AUTHORITY\\SYSTEM";
WorkingDirectory = "C:\\windows\\system32\\";
};
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Raised Program Started Event for Ad:P0120004, Package:P0100029, Program: Uninstall Java
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P0100029",ProgramID="Uninstall Java", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P0100029",ProgramID="Uninstall Java", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
MTC task with id {6D6AB20E-A776-444D-AD24-C33A38CAAEB0}, changed state from 4 to 5
execmgr
02/12/2015 16:41:39
3760 (0x0EB0)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P010002A",ProgramID="Java 8.0.66", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
4892 (0x131C)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P010002A",ProgramID="Java 8.0.66", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
Program exit code 1
execmgr
02/12/2015 16:41:39
3636 (0x0E34)
Looking for MIF file to get program status
execmgr
02/12/2015 16:41:39
3636 (0x0E34)
Script for Package:P0100029, Program: Uninstall Java failed with exit code 1
execmgr
02/12/2015 16:41:39
3636 (0x0E34)
Raising event:
[SMS_CodePage(850), SMS_LocaleID(6153)]
instance of SoftDistProgramErrorEvent
{
AdvertisementId = "P0120004";
ClientID = "GUID:EA79FDBB-F478-40FC-9598-696EDBF74BA5";
DateTime = "20151202164139.560000+000";
ExitCode = "1";
MachineName = "BNW7-20427";
PackageName = "P0100029";
ProcessID = 5072;
ProgramName = "Uninstall Java";
SiteCode = "P01";
ThreadID = 3636;
UserContext = "NT AUTHORITY\\SYSTEM";
};
execmgr
02/12/2015 16:41:39
3636 (0x0E34)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P010002A",ProgramID="Java 8.0.66", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
Raised Program Error Event for Ad:P0120004, Package:P0100029, Program: Uninstall Java
execmgr
02/12/2015 16:41:39
3636 (0x0E34)
Execution is complete for program Uninstall Java. The exit code is 1, the execution status is FailureNonRetry
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
Requesting MTC to delete task with id: {6D6AB20E-A776-444D-AD24-C33A38CAAEB0}
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
MTC task with id: {6D6AB20E-A776-444D-AD24-C33A38CAAEB0} deleted successfully.
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="P010002A",ProgramID="Java 8.0.66", actionType 10l, value Result:FALSE, user NULL, session 4294967295l, level 0l, verbosity 30l
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
Deleting request for program Uninstall Java. Failing parent program Java 8.0.66
execmgr
02/12/2015 16:41:39
2676 (0x0A74)
The script is:
Option Explicit
Dim wshShell, fso, strLogFile, ts, strTempDir, strTempISS, strUnString, tsIn, blFound
Dim strUninstLine, CLSID, search5, search6, search7, strJRE1, strDisplayName, strDisplayVersion
Dim strPublisher, strUninstallString, strJREUninstallString, strJREDisplayName
Dim search1, search2, search3, search4, strJREUninstallStringNEW, ret, strUninstCMD
Dim tsISS, strSetupexe, qVal, strComputername
qVal = 0
Set wshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
strComputername = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
If Not fso.FolderExists("C:\Logs") Then fso.CreateFolder("C:\Logs")
strLogFile = "C:\Logs\Java_Uninstall_" & strComputername & ".log"
Set ts = fso.OpenTextFile(strLogFile, 8, True)
ts.WriteLine String(80, "_")
ts.WriteLine String(80, "¯")
ts.WriteLine Now() & " - Java Runtime(s) uninstallation"
ts.WriteLine String(80, "_") & vbCrlf
'# Generate Registry extracts from 'Uninstall' keys.
PreFlight()
'# Kill Java Processes
KillProc()
strTempDir = wshShell.ExpandEnvironmentStrings("%temp%")
strTempISS = strTempDir & "\iss"
strUnString = " -s -a /s /f1"
Set tsIn = fso.OpenTextFile(strTempDir & "\uninstall.tmp", 1)
If Not fso.FolderExists(strTempISS) Then fso.CreateFolder(strTempISS)
blFound = False
Do While Not tsIn.AtEndOfStream
strUninstLine = tsIn.ReadLine
CLSID = Mid(strUninstLine, 73, 38)
search5 = Instr(strUninstLine, "JRE 1")
search6 = Instr(strUninstLine, "]")
If search5 > 0 AND search6 > 0 Then
strJRE1 = Replace(Mid(strUninstLine, search5, search6),"]","")
End If
On Error Resume Next
strDisplayName = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\DisplayName")
strDisplayVersion = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\DisplayVersion")
strPublisher = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\Publisher")
strUninstallString = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & CLSID & "\UninstallString")
strJREUninstallString = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & strJRE1 & "\UninstallString")
strJREDisplayName = wshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & strJRE1 & "\DisplayName")
On Error Goto 0
'Search for presence of Java and Sun in DisplayName and Publisher
search1 = Instr(1, strDisplayName, "Java", 1)
search2 = Instr(1, strPublisher, "Sun", 1)
search3 = Instr(1, strDisplayName, "J2SE", 1)
search4 = Instr(1, strUninstallString, "setup.exe", 1)
search7 = InStr(1, strDisplayName, "Development", 1) + InStr(1, strDisplayName, "Java DB", 1)
If strJREUninstallString <> "" Then
blFound = True
'# JRE 1 found
strJREUninstallStringNEW = Replace(strJREUninstallString," -f"," -s -a /s /f")
ts.WriteLine Now() & " - " & strJREDisplayName
ts.WriteLine Now() & " - Uninstall String sent: " & strJREUninstallStringNEW
ret = wshShell.Run(strJREUninstallStringNEW , 0, True)
ts.WriteLine Now() & " - Return: " & ret
If ret <> 0 And ret <> 3010 Then qVal = 1
ElseIf search7 = 0 And search1 > 0 Or search3 > 0 And search2 > 0 Then
blFound = True
strUninstCMD = "msiexec.exe /x " & CLSID & " /norestart /qn"
If search4 > 0 Then
'# Old InstallShield setup found
Set tsISS = fso.OpenTextFile(strTempISS & "\" & CLSID & ".iss", 2, True)
'Create Response file for any Java Version
tsISS.WriteLine "[InstallShield Silent]"
tsISS.WriteLine "Version=v6.00.000"
tsISS.WriteLine "File=Response File"
tsISS.WriteLine "[File Transfer]"
tsISS.WriteLine "OverwrittenReadOnly=NoToAll"
tsISS.WriteLine "[" & CLSID & "-DlgOrder]"
tsISS.WriteLine "Dlg0=" & CLSID & "-SprintfBox-0"
tsISS.WriteLine "Count=2"
tsISS.WriteLine "Dlg1=" & CLSID & "-File Transfer"
tsISS.WriteLine "[" & CLSID & "-SprintfBox-0]"
tsISS.WriteLine "Result=1"
tsISS.WriteLine "[Application]"
tsISS.WriteLine "Name=Java 2 Runtime Environment, SE v1.4.0_01"
tsISS.WriteLine "Version=1.4.0_01"
tsISS.WriteLine "Company=JavaSoft"
tsISS.WriteLine "Lang=0009"
tsISS.WriteLine "[" & CLSID & "-File Transfer]"
tsISS.WriteLine "SharedFile=YesToAll"
tsISS.Close
strSetupexe = Left(strUninstallString, search4 + 9)
strUninstCMD = strSetupexe & strUnString & Chr(34) & strTempISS & "\" & CLSID & ".iss" & Chr(34)
End If
ts.WriteLine Now() & " - " & strDisplayName & " - Version: " & strDisplayVersion
ts.WriteLine Now() & " - Uninstall String sent: " & strUninstCMD
ret = wshShell.Run(strUninstCMD , 0, True)
ts.WriteLine Now() & " - Return: " & ret
If ret <> 0 And ret <> 3010 Then qVal = 1
End If
Loop
tsIn.Close
If Not blFound Then
ts.WriteLine Now() & " - No Java Runtime versions found installed."
qVal = 99
End If
ts.WriteLine String(80, "_")
ts.WriteLine String(80, "¯")
ts.Close
fso.DeleteFolder(strTempISS)
fso.DeleteFile(strTempDir & "\uninstall.tmp")
WScript.Quit(qVal)
Sub PreFlight()
'# Creates temp files containing extracts from registry 'Uninstall' keys.
Dim wshShell, fso, sTemp
Set wshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
sTemp = wshShell.ExpandEnvironmentStrings("%temp%")
wshShell.Run "REGEDIT /E %temp%\registry.tmp HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\windows\currentversion\uninstall", 0, True
wshShell.Run "cmd /c type %temp%\registry.tmp | find /i ""{"" | find /i ""}]"" > %temp%\uninstall.tmp ", 0, True
wshShell.Run "cmd /c type %temp%\registry.tmp | find /i ""JRE 1"" >> %temp%\uninstall.tmp ", 0, True
If Not fso.FileExists(sTemp & "\uninstall.tmp") Then
ts.WriteLine Now() & " - No input - %temp%\uninstall.tmp Reg extract not created."
ts.WriteLine String(80, "_")
ts.WriteLine String(80, "¯")
ts.Close
WScript.Quit(1)
End If
End Sub
Sub KillProc()
'# kills jusched.exe and jqs.exe if they are running. These processes will cause the installer to fail.
Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "Taskkill /F /IM jusched.exe /T", 0, True
wshShell.Run "Taskkill /F /IM jqs.exe /T", 0, True
End Sub