Java 6_22
hello all , another day wasted on java ugh!
i need a script that removes all java from a machine and installs the newest version of java and disabled auto updates, also need a working msi that i can deploy over sccm can anyone assist ? i have tried to extract the msi from the installer without luck there is not .cab file only and msi,mst
ugh!
i need a script that removes all java from a machine and installs the newest version of java and disabled auto updates, also need a working msi that i can deploy over sccm can anyone assist ? i have tried to extract the msi from the installer without luck there is not .cab file only and msi,mst
ugh!
0 Comments
[ + ] Show comments
Answers (8)
Please log in to answer
Posted by:
ccwbutler
14 years ago
I have used a wmi script, which I change to a cmd file, and then distribute it through SCCM, first, then run the JRE 1.6.0.22 package. Just have it run silently, and the user never sees anything. You can put it in the package, buy converting it to an exe, but I had mixed results with this. I have used this for several package removals, when I have an environment that has multiple old versions, and/or the Upgrade does not work in WPS.
Anyways, here is the script:
wmic product where "name='Exact Add/Remove JRE Name'" call uninstall /nointeractive
This is the site that explains the technology: http://community.spiceworks.com/how_to/show/179
Anyways, here is the script:
wmic product where "name='Exact Add/Remove JRE Name'" call uninstall /nointeractive
This is the site that explains the technology: http://community.spiceworks.com/how_to/show/179
Posted by:
Lucid
14 years ago
Here's a snippet of some quick VBScript code you might be able to use to put together your own script to uninstall all existing versions:
RemoveOldVersions "Java 2 Runtime Environment"
RemoveOldVersions "J2SE Runtime Environment 5.0"
RemoveOldVersions "Java(TM) 6"
' ~$~----------------------------------------~$~
Sub RemoveOldVersions(strValueCheck)
Dim intLength, objReg, strKeyPath, subkey, arrSubKeys, strValue, strCheckKey, strUninstallString, intUninstallReturn
'Removing current installations from the machine
intLength = Len(strValueCheck)
strUninstallString = ""
strKeyPath = strSoftwareRegistryKey & "\Microsoft\Windows\CurrentVersion\Uninstall"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strValue = ""
strCheckKey = strKeyPath & "\" & subkey
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCheckKey,"DisplayName",strValue
If Not IsNull(strValue) Then
If UCase(strValueCheck) = UCase(Left(strValue, intLength)) Then
' Attempts to obtain the UninstallString for the matching string.
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCheckKey,"UninstallString",strValue
strUninstallString = strValue
End If
End If
Next
If strUninstallString <> "" Then
'Matching string found
intUninstallReturn = objWshShell.Run (strUninstallString & " /quiet /norestart", 1, True)
End If
End Sub
As for getting the .MSI...
1. Obtain the Offline Source file .EXE from http://www.java.com/en/download/manual.jsp.
A. Don't forget to Unblock the downloaded .EXE files.
2. Navigate to the logged in user's Application Data folder (for example: C:\Documents and Settings\JoeUser\Application Data or C:\Users\JoeUser\AppData\LocalLow).
3. Launch the downloaded .EXE installation file, but do NOT install the program (just leave it running at the initial installation window).
4. Copy ALL the files from the "...\Sun\Java\XXXX" folder containing the extracted contents of the downloaded .EXE file to another location.
5. Cancel the installation setup.
Make sure you grab all the files and put those into a folder to be used as the basis for your SCCM package. Then just use standard .MSI switches to install when you deploy it...
RemoveOldVersions "J2SE Runtime Environment 5.0"
RemoveOldVersions "Java(TM) 6"
' ~$~----------------------------------------~$~
Sub RemoveOldVersions(strValueCheck)
Dim intLength, objReg, strKeyPath, subkey, arrSubKeys, strValue, strCheckKey, strUninstallString, intUninstallReturn
'Removing current installations from the machine
intLength = Len(strValueCheck)
strUninstallString = ""
strKeyPath = strSoftwareRegistryKey & "\Microsoft\Windows\CurrentVersion\Uninstall"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
strValue = ""
strCheckKey = strKeyPath & "\" & subkey
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCheckKey,"DisplayName",strValue
If Not IsNull(strValue) Then
If UCase(strValueCheck) = UCase(Left(strValue, intLength)) Then
' Attempts to obtain the UninstallString for the matching string.
objReg.GetStringValue HKEY_LOCAL_MACHINE,strCheckKey,"UninstallString",strValue
strUninstallString = strValue
End If
End If
Next
If strUninstallString <> "" Then
'Matching string found
intUninstallReturn = objWshShell.Run (strUninstallString & " /quiet /norestart", 1, True)
End If
End Sub
As for getting the .MSI...
A. Don't forget to Unblock the downloaded .EXE files.
2. Navigate to the logged in user's Application Data folder (for example: C:\Documents and Settings\JoeUser\Application Data or C:\Users\JoeUser\AppData\LocalLow).
3. Launch the downloaded .EXE installation file, but do NOT install the program (just leave it running at the initial installation window).
4. Copy ALL the files from the "...\Sun\Java\XXXX" folder containing the extracted contents of the downloaded .EXE file to another location.
5. Cancel the installation setup.
Make sure you grab all the files and put those into a folder to be used as the basis for your SCCM package. Then just use standard .MSI switches to install when you deploy it...
Posted by:
anonymous_9363
14 years ago
I think your script would be better off checking for the ProductCode key rather than DisplayName value: it is, after all, the unique identifier for each product.
Also, like so much beginner-level script, it has ZERO error-trapping. All code should always assume that NOTHING will work, even the setting up of common objects, such as the FileSystemObject object and so on.
Also, like so much beginner-level script, it has ZERO error-trapping. All code should always assume that NOTHING will work, even the setting up of common objects, such as the FileSystemObject object and so on.
Posted by:
Lucid
14 years ago
VBScab... I never said it was a fully functioning script with all the bells and whistles... And the reason it's coded this way is because there's no way to know all the product codes for all previous versions. At least I've never run across a complete list. If you've got a list, please feel free to share it...
Posted by:
skt
14 years ago
Posted by:
kardock
14 years ago
Posted by:
anonymous_9363
14 years ago
So amusing...
Actually, WMPCTS, Java is a simple install. It's a bunch of junk in 'C:\Program Files\JavaSoft', HKLM\Software\JavaSoft and HKCU\Software\JavaSoft. That makes an uninstall R E A L L Y simple: just delete the folder and registry keys.
If you feel like extending yourself, your script could delete any registry key in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall which refers to an InstallLocation at 'C:\Program Files\JavaSoft'. No worries about ProductCode, potential DisplayName conflicts and so on.
Oh and BTW, IIRC, someone already published a list of JRE ProductCodes here on AD.
Actually, WMPCTS, Java is a simple install. It's a bunch of junk in 'C:\Program Files\JavaSoft', HKLM\Software\JavaSoft and HKCU\Software\JavaSoft. That makes an uninstall R E A L L Y simple: just delete the folder and registry keys.
If you feel like extending yourself, your script could delete any registry key in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall which refers to an InstallLocation at 'C:\Program Files\JavaSoft'. No worries about ProductCode, potential DisplayName conflicts and so on.
Oh and BTW, IIRC, someone already published a list of JRE ProductCodes here on AD.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.