/build/static/layout/Breadcrumb_cap_w.png

Silently deploying Java 7 Update 67

I am using Kace version 6, so my notes are making that assumption.   I am new to Kace, but I've seen several posts referencing version 5 and it looks pretty different. 

Around the beginning of August Microsoft announced that they will start blocking older ActiveX (including Java versions previous to 7 Update 67).     After nearly a month of fighting with this Kace appliance, I finally found a solution for deploying the 7 Update 67 upgrade silently to our clients.   I've tested it and it appears to be working on all versions of Windows, so I thought I'd share and hopefully save someone else some headaches. 

There are actually two parts to the process.   1.) Remove old versions of Java, and 2.) Install 7 Update 67 (both 32 and 64 bit OS). 

 (1) Remove All Old Versions...  
    • Create a VBScript that will go through and remove each version separately.   Note:  This is not the fancy looping scripts that you may find.  It's pretty straight forward, but it does the trick.  You will need to enter the uninstall keys manually, but it's pretty easy once you have the pattern down.    (Source for original Idea which I tweaked a bit)
      • You can find a lot of uninstall codes here http://www.74k.org/java-uninstall-remove-guids-strings
      • If you look closely you can see the patterns and probably come up with your own.   
      • Alternatively, you can go to the registry and locate the "PackageCode" from the appropriate key under 'HKCR\Installer\Products' where the 'ProductName' matches the version of Java you're wanting to remove.   
      • Kace also provides the uninstall command in the 'Software' listing.   
    on error resume next
    
    dim WshShell
    dim RegKey
    dim ScriptVerKey
    
    Set WshShell = CreateObject("WScript.Shell")
    
    'checks to see if registry key exists, if it does, the cleanup runs.
    RegKey = "HKLM\SOFTWARE\EDU\Cleanup\"
    ScriptVerKey = WshShell.RegRead(RegKey & "JAVAOldVer")
    
    if ScriptVerKey <> "1" Then 
      Cleanup()
     Else 
      WScript.Quit
    End If
    
    Sub Cleanup()
    
    
    ' Uninstall Java 1.4.1.01
    WshShell.Run "msiexec /x {1666FA7C-CB5F-11D6-A78C-00B0D079AF64} /q",1,True
    ' Uninstall Java 1.4.2.04
    WshShell.Run "msiexec /x {7148F0A8-6813-11D6-A77B-00B0D0142040} /q",1,True
    
    '//== VERSION 5 == 
    ' Uninstall Java 5.0.2
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150020} /q",1,True
    ' Uninstall Java 5.0.4
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150040} /q",1,True
    ' Uninstall Java 5.0.5
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150050} /q",1,True
    ' Uninstall Java 5.0.6
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150060} /q",1,True
    ' Uninstall J2SE Development Kit 5.0 Update 6
    WshShell.Run "msiexec /x {2F4A3A23-297B-6D11-7AA8-000B0D510006} /q" 1,True
    ' Uninstall Java 5.0.7
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150070} /q",1,True
    ' Uninstall Java 5.0.10
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150100} /q",1,True
    ' Uninstall Java 5.0.11
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150110} /q",1,True
    ' Uninstall Java 5.0.12
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0150120} /q",1,True
    
    
    '//== VERSION 6 == 
    ' Uninstall Java 6.0.0
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160000} /q",1,True
    ' Uninstall Java 6.0.1
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160010} /q",1,True
    ' Uninstall Java 6.0.2
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160020} /q",1,True
    ' Uninstall Java 6 Update 26
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216026FF} /q",1,True
    ' Uninstall Java 6 Update 27
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216027FF} /q",1,True
    ' Uninstall Java 6 Update 29 – 64 bit
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86416029FF} /q",1,True
    ' Uninstall Java 6 Update 29
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216029FF} /q",1,True
    ' Uninstall Java 6.0.30 
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160030} /q",1,True
    ' Uninstall Java 6 Update 31
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216031FF} /q",1,True
    ' Uninstall Java 6 Update 37
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83216037FF} /q",1,True
    ' Uninstall Java 6.0.5
    WshShell.Run "msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160050} /q",1,True
    
    '//== VERSION 7 ==
    ' Uninstall Java 7 Update 11
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217011FF} /q",1,True
    ' Uninstall Java 7 Update 40
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217004FF} /q",1,True
    ' Uninstall Java 7 Update 5
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217005FF} /q",1,True
    ' Uninstall Java 7 Update 5  – 64 bit
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417005FF} /q",1,True
    ' Uninstall Java 7.0.51
    '//WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217051FF} /q",1,True
    ' Uninstall Java 7.0.51  – 64 bit
    '//WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F86417051FF} /q",1,True
    ' Uninstall Java 7 Update 55
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F83217055FF} /q",1,True
    ' Uninstall Java 7 Update 60
    WshShell.Run "msiexec /x {26A24AE4-039D-4CA4-87B4-2F03217060FF} /q",1,True
    
    
    'regkey below stops the script from running again
    WshShell.RegWrite "HKLM\Software\EDU\", "Default"
    WshShell.RegWrite "HKLM\Software\EDU\Cleanup\", "Default"
    WshShell.RegWrite "HKLM\Software\EDU\Cleanup\JAVAOldVer", 1, "REG_SZ"
    
    End Sub

    • Create new "Script" task 
    • Under "Schedule" make sure you check 'Allow run without a logged-in user' 
    • Upload this script as a "Dependency" 
    • Verify
      • Verify a directory exists...
      • Directory: $(KACE_SYS_DIR) (I just did this to get passed the verify stage, maybe not needed, but I'm not that smart) 
    • On Success
      • Launch a program...
      • Directory: $(KACE_SYS_DIR)
      • File: cscript.exe
      • Check 'Wait for completion' 
      • Parameters: $(KACE_DEPENDENCY_DIR)\Java-All-Uninstall.vbs (or whatever you called the vbs) 
    • Set up the rest of this script to meet your needs.

(2) Distribution task to deploy Java

    • Download the executable from Java http://www.java.com/en/download/manual.jsp
      • Download the 32 and 64 bit versions (This post doesn't cover Mac) 
    • Associate the exe with the software under 'Inventory...Software'   
    • Create a new 'Managed Install'  (Distribution...Managed Installations)  (Two actually, one for 64bit and one for 32bit but the steps for each are the same.  Just select all windows for the 32bit, and only 64bit windows for the 64bit.  This is because Java is linked to the version of IE that the person is using, and a lot of people are still using IE 32bit even on 64bit machines.) 
    • Name your 'Managed Installation' 
    • From the software drop down select your version of Java
    • I used the following 'Additional Parameters'   /s /l c:\temp\java_64x_update.log STATIC=1 
      • [theatrebyte] pointed out that the 'STATIC=1' would probably not be needed by most.   This is correct.  I included it because we have to specifically control our Java (our Payroll software requires it) and we often have to have multiple versions installed as a result.   I've striked it out, but if you want to know what it does see theatrebyte's comment below.  
    • Complete the rest of the stuff as necessary for your specific environment. 
This was tested on several systems from Windows XP to 2012R2 server.   It worked flawlessly on all of these systems.    I was pretty excited when I finally figured it out after spending nearly a month off and on fighting with MSI switches, UAC, and the disgracefully useless logs that are generated by all of this.     




Comments

  • I assume most people will not need to use the STATIC additional parameter.

    If you install without it then you can patch or upgrade to new versions without first having to remove old versions as the installer will do this. It's called patch in place. - theatrebyte 6 years ago
    • You are correct. Thanks. I updated the posting. We used it because we don't allow users to upgrade, and we have to specifically control the Java versions (currently we have to have two versions installed simultaneously because our payroll software is really finicky. The Java issue is actually the main driver for us purchasing the Kace in the first place. - rmavery 6 years ago
  • Another way to uninstall is to use the wmic :

    wmic product where "name like 'java%'" call uninstall /no interactive

    This will uninstall all java versions. Take care to double the % in scripts. - gwir 6 years ago
    • Thanks gwir. Good to know. Unfortunately we needed to keep 7u51 for a specific software (which required that until we could get it upgraded) and we also needed to install 7u67. That is a good trick though if we ever decide to nuke all of the Java. - rmavery 6 years ago
    • Cool trick! However, you have a space between '/no' and 'interactive'.
      Should be
      wmic product where "name like 'java%'" call uninstall /nointeractive - adaml 6 years ago
      • You're right, it's a typo. - gwir 6 years ago
This post is locked

Don't be a Stranger!

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

Sign up! or login

Share

 
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