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


0 Comments   [ + ] Show comments

Answers (8)

Posted by: ccwbutler 12 years ago
Senior Yellow Belt
I have used a wmi script, which I change to a cmd file, and then distribute it through SCCM, first, then run the JRE 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
Posted by: Lucid 12 years ago
Purple Belt
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
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...
Posted by: anonymous_9363 12 years ago
Red Belt
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.
Posted by: jakedavidoff 12 years ago
Senior Yellow Belt
Does anyone already have a script I can use
Posted by: Lucid 12 years ago
Purple Belt
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 12 years ago
Orange Senior Belt

Why you want to do it using vb script.??? you can do it in MST , take older upgrade code and put it in newr version application. it will uninstall and install new one.
Posted by: kardock 12 years ago
Second Degree Green Belt


Why you want to do it using vb script.??? you can do it in MST , take older upgrade code and put it in newr version application. it will uninstall and install new one.

the OP said he does not have all the codes.
Posted by: anonymous_9363 12 years ago
Red Belt
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ