This is an update from this post


I’m in the process of upgrading all client computers from Java version 6.31 to Java 7.4.  Like all major version upgrades of Java if you simply install the new version the old version will remain installed.  Therefore, I’ve included instructions that allows you to remove the old version of Java, install the latest version, and then apply an update policy to fit your needs.

  1. To uninstall the old Java, navigate to the registry key that gives you the proper uninstall string.
    If you are using 32-bit version of Windows it should be under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
    For 64-bit Windows you might need to go to HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
    Navigate to the key under the uninstall key associated with Java (may be a long ID).  There will be an UninstallString item that will be something like MsiExec /X{________}.  This will be the first part of your batch file.  I include /quiet and /norestart switches (see below)
  2. Next, on a test computer I downloaded Java and acquired the .msi file (see http://java.com/en/download/help/msi_install.xml).  The instructions are for Java version 6, but still apply.  The next line in your batch file will use this .msi file to install Java ex: jre.msi /qn
  3. Finally, on your test computer I set my update policy so that it does not look for updates because my user accounts are standard user accounts and would prohibit users from installing any updates.  To be clear, I diligently patch all computers but I just like to control this process versus having a nagging update balloon show up for users when they can’t do anything about it.  You can change your update policy by clicking on the Java icon in control panel.  Your update policy can be found in registry under HKLM\SOFTWARE\JavaSoft\Java Update\Policy.  I also manually create a binary key EnableJavaUpdate (if it doesn’t exist already) and set it to 0 (as in zero).  Once you’re satisfied with this policy, export the entire Policy key as a .reg file.  The final line in your batch file will look like regedit.exe /s JavaPolicy.reg
    My policy looked like this when finished:
  4. In your Java package you should have 3 files.  A batch file which fires off all the commands, the Java 7 msi install file, and the exported reg file.  My batch file has the following:
    @echo off
    REM Uninstall Java 6 Update 31
    MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216031FF} /quiet /norestart
    REM Install Java 7 Update 4
    jre1.7.0_04-c.msi /qn
    REM Update registry to prevent users being prompted to update java
    regedit.exe /s JavaPolicy.reg
  5. On SCCM, you will need to either create a new package or update an existing package by updating all distribution points with your 3 files.
    Included are screenshots of parameters for the SCCM program which points to my batch script as well as parameters for the advertisement.
  1. […] Using SCCM to migrate client computers from Java version 6 to version 7 […]

  2. Matt says:

    Great post! The only problem that I have in my environment, is I don’t know what version of java is installed on machines…unfortunately techs are able to update java on whatever machine they please whenever they please. I have some machines running v6 u 23 all the way through v7 u5. How should I do this so I can uninstall whatever version of java they have before installing the new one?


    • Seth says:

      If you have software that keeps an inventory of installed software on your network, check the registry of computers with each JRE version to see if the uninstall string has changed from version to version (I’m not sure off the top of my head). If the string is the same for all versions, you’re good to go, otherwise just add multiple entries for each possible uninstall needed. If the version isn’t installed it will just move to the next line. You could also create custom computer collections in SCCM and then have a corresponding package that runs depending on the version installed…either way

  3. AJ says:

    Thank you for awesome guide. i did have one question regarding the installation portion. The installation part works great but java will not install after that. Do i have to specify the msi location \\server\\.msi i already created the java 7 package. Does the name have to be the same as the package name? Thanks for you help

  4. Seth says:

    Did you mean to say the UNINSTALL works great, but java will not install? The msi file should be in the same folder as the .bat file and the .reg file. In the properties of your SCCM package, there is a tab called Data Source (at least in my SCCM 2007 environment). So long as you update the distribution point and have all clients download content from the distribution point (set in the Distribution Points tab of the advertisement), then the .bat file will not need to have a full path to the .msi because it will reside in the same folder. At least, that’s how I did it.

    • Aj says:

      Thank you for the reply. Sorry i met uninstall. The uninstall works great but the install does not go through but the status of the advertisement says successful. Should there be 3 seperate packages java 7.msi java.bat and javareg. or just one package java.bat that uses all 3 in a folder?

  5. Seth says:

    1 package that runs java.bat
    the bat file runs the uninstall by using MsiExec and then calls the javareg and msi file

  6. Yps says:

    I think it´s best to let users also be notify about java updates, because it comes alot of new java versions, and they needs to be patches all the time.
    I should have added a kill on IExplorer (and all other browsers also) and all java process before the updates, so not the updates are failing.

    I also got users that installs the x64 versions of Java, it´s a real mess to maintance now with all secuirty holes in Java.

  7. Rob C says:

    This is what I’ve gathered in case anyone wants an example of creating a vbscript to uninstall older versions of Java:

    Option Explicit
    Dim ObjWshShell

    Set objWshShell = WScript.CreateObject(“WScript.Shell”)

    ‘Java 7 Update 10 (64-bit) Removal
    ‘objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F86417010FF} /passive”, 1, True
    ‘Java 7 Update 10 (32-bit) Removal
    ‘objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217010FF} /passive”, 1, True
    ‘Java 7 Update 9
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217009FF} /passive”, 1, True
    ‘Java 7 Update 8
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217008FF} /passive”, 1, True
    ‘Java 7 Update 7
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217007FF} /passive”, 1, True
    ‘Java 7 Update 6
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217006FF} /passive”, 1, True
    ‘Java 7 Update 5
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217005FF} /passive”, 1, True
    ‘Java 7 Update 4
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217004FF} /passive”, 1, True
    ‘Java 7 Update 3
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217003FF} /passive”, 1, True
    ‘Jave 7 Update 2
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217002FF} /passive”, 1, True
    ‘Jave 7 Update 1
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83217001FF} /passive”, 1, True
    ‘Java 6 Update 31
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216031FF} /passive”, 1, True
    ‘Java 6 Update 30
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216030FF} /passive”, 1, True
    ‘Java 6 Update 29
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216029FF} /passive”, 1, True
    ‘Java 6 Update 28
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216028FF} /passive”, 1, True
    ‘Java 6 Update 27
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216027FF} /passive”, 1, True
    ‘Java 6 Update 26
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216026FF} /passive”, 1, True
    ‘Java 6 Update 25
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216025FF} /passive”, 1, True
    ‘Java(TM) 6 Update 24
    objWshShell.Run “MsiExec.exe /Uninstall {26A24AE4-039D-4CA4-87B4-2F83216024FB} /passive”, 1, True


  8. Paul says:

    I in the process of trying this with the VB script posted above. The installation seems to be hung. I have been waiting for well over a half hour for this to compete. In Software Center it just says Installing. I was hoping it would time out but nothing yet.

  9. Paul says:

    I fixed the characters in the vb script and it runs but Java 6 u30 did not uninstall. Installing the new Java works great.

  10. Roger says:

    Who is having issues with CM12 Software Updates installing JRE7u11 (x86)? I can get jre6u38 and jre7u11 (x64) to work fine but the 32 bit version fails every time. Manual installs and deploying the application work just fine. It is only when using SCUP 2011 where it fails. so frustrating…

  11. Brandon says:

    Seth – if you get a chance – email me – I would like to pick your brain why the script seems to be failing