Updating Java with SCCM the Easy Way

Java updates itself more frequently than we update this blog. This can make administering your environment a chore, especially if you are surrounded by a team of Chicken Littles, screaming about how vulnerable your environment is if you do not update quickly.

While I am of the mindset that, yes, the holes that have recently been exploited in Java are serious and should be patched, I also believe that, if you have the proper security measures in place, you are typically safe. Nevertheless, I decided to deploy the most recent version (as of this writing, Java 7 Update 21) to our workstations.

Obviously, the best way to deploy anything to user workstations is via SCCM. However, since Microsoft does not offer 3rd party updates through the Software Update Point, and (in my opinion) using SCUP to update 3rd party software is a chore, I decided to customize a series of scripts that I found to make updating Java a breeze. As a bonus, the script adds a registry key to disable Java auto-updates. The steps are as follows:

1)      Find and run the executable to display the splash screen, but DO NOT CLICK THROUGH THE PROMPTS (did I say that loud enough?):

Image

2)      Browse to %userprofile%\AppData\LocalLow\Sun\Java and copy the directory (or directories if deploying both x64 and x86 versions) to the location in which you store your SCCM software packages; these directories contain the necessary .msi and .cab files for this deployment:

Image

Image

3)      Copy the two following scripts to the same location as you copied the Java folders; the .cmd kicks off the install, killing all open browsers and calls the .vbs which installs all previous versions of Java:

***Install.cmd ***

@echo off

taskkill /F /IM iexplorer.exe

taskkill /F /IM iexplore.exe

taskkill /F /IM firefox.exe

taskkill /F /IM chrome.exe

taskkill /F /IM javaw.exe

taskkill /F /IM jqs.exe

taskkill /F /IM jusched.exe

REM Call the uninstall script

cscript %~dp0Java_Uninstall.vbs

REM Install JRE x86

msiexec.exe /i %~dp0\Java7Update21_x86\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x86.log

REM Installing JRE x64

if exist %ProgramFiles(x86)%

msiexec.exe /i %~dp0\Java7Update21_x64\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x64.log

REM Disable automatic updates

reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f

reg add “HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

REM Return the exit code to SCCM

exit /B %EXIT_CODE%

______________________________________________________________________

***Java_Uninstall.vbs***

On Error Resume Next

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:” _

& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

‘Uninstall Java 2 Runtime Environment, J2SE Runtime Environment

Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java 2 Runtime Environment Standard Edition %'”)

For Each objSoftware in colJava4dot3

objSoftware.Uninstall()

Next

 

‘Uninstall Java 2 Runtime Environment, J2SE Runtime Environment

Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘J2SE Runtime Environment %'”)

For Each objSoftware in colJava4dot3

objSoftware.Uninstall()

Next

‘Uninstall Java 2 Runtime Environment, SE *

Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java 2 Runtime Environment, SE %'”)

For Each objSoftware in colJava4dot3

objSoftware.Uninstall()

Next

‘Uninstall Java(TM) 6 Update *

Set colJava6dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) 6 Update %'”)

For Each objSoftware in colJava6dot

objSoftware.Uninstall()

Next

‘Uninstall Java(TM) 7 Update *

Set colJava6dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) 7 Update %'”)

For Each objSoftware in colJava6dot

objSoftware.Uninstall()

Next

‘Uninstall Java(TM) 7 *

Set colJava7 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) %'”)

For Each objSoftware in colJava7

objSoftware.Uninstall()

Next

 

4)      Create a program to run the Install.cmd whether or not a user is logged on

5)      Distribute the files to the distribution point

6)      Deploy to your collection of machines that are to receive the update (after you test, of course)

7)      Repeat in 2 weeks when Java is updated again…

Now that you have these scripts, you only need to replace the files using steps one and two whenever Java needs updating. I hope this helps those who are looking for a quick way to deploy Java updates to their environment using SCCM!

Advertisements

50 thoughts on “Updating Java with SCCM the Easy Way

  1. This is, by far, the best solution I’ve seen for deploying Java. I’d love a “set it and forget it” method more but this seems more trustable. Thank you! I do have one small question though. for verification, what do you point to? I feel this may be a silly question but I am very new to SCCM and just looking for best practice, in your profesisonal opinion.

    • That’s not a silly question at all. What I did is I created a directory where I store all of my applications and packages and named it “Java.” Within that directory, I created two more directories called “Java7Update21_x86” and “Java7Update21_x64” and saved the corresponding .msi and .cab files in each. I then saved my Java_Install.cmd and Java_Uninstall.vbs to the root of the Java directory. In SCCM, I went through the process of creating a package and pointed to the Java directory as its source destination (i.e. \\\\Java) and created a program that used Java_Install.cmd. Note that it is very important to configure your script to point to the sub-directories that contain your Java .msi and .cab files.

      Let me know if you have any more questions or if you need clarification on the above. I will add a screenshot to the original post showing the Java directory as I described.

      • Does this just run against all machines or is it based on a AD group? How do you control what machines get this update? In my environment we have a need for Java 6 and Java 7 much to my dismay. Can this also be applied to the Java 6 machines?

      • Hi, David. The method I use deploys the software via SCCM to a collection. Basically, I have a collection that queries the All Systems collection for machines without Java or with Java and a version lower than what I am deploying. As for the second part of your question, this can absolutely be applied to Java 6 machines. However, the script to remove Java will strip all Java versions. What I would do for machines that require both Java 6 and 7 is alter the script to remove all Java and install Java 6 update (?). Then, follow that up with a Java 7 update (?) deployment as it will install on top.

      • You can also use msiexec.exe /i %~dp0\Java7Update21_x86\jre1.7.0_25.msi /q /passive /norestart AUTOUPDATECHECK=0 JAVAUPDATE=0 IEXPLORER=1 as parameters to disable updates.

      • Hey, Remy. I typically have issues (albeit, primarily with Adobe products) when I attempt to run parameters such as those. However, I cannot disagree with you; that should work. I suppose it is a matter of preference and whether or not you are comfortable with directly modifying the registry.

        Thanks for the comment!

    • Hi Jesse,

      Did I say something wrong below to prevent my posting? It may be that you’re very busy but if there’s something I can change just let me know. Would love to collaborate on this.

      You can delete this post. Thanks again.

      • Hey, Bubba-

        So sorry…I have, in fact, been very slammed! I approved your previous comments and DEFINITELY appreciate the collaboration. That’s how we all get better, right? Please continue to follow and post. I love your suggestions and comments!

        -Jesse

  2. Hi, good work!
    I keep getting exitcode 255 when I run it on a win7 x86 system.
    But Java gets installed. I changed the cmd to “Exit 0” but it still Returns failed With exit code 255.
    Any ideas why?

    • Thanks, Rod!

      I am guessing that the machine is attempting to run the x64 installer as well. I ran into a similar issue at a client where a certain piece of software (PDFCreator, I believe) actually created a “Program Files (x86)” directory on their x86 Win7 machines. Therefore, this script would see that directory (“if exist %ProgramFiles(x86)%”) and attempt to run the 64-bit installer. So, if Java is actually uninstalling and installing the x86 version but returning that code, this is probably your issue. Just REM out those two lines and test. NOTE: if that is the case, then their should still be a Java7x64.log file in C:\Windows\Temp that you can use as reference.

      REM if exist %ProgramFiles(x86)%

      REM msiexec.exe /i %~dp0\Java7Update21_x64\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x64.log

      • Ok.
        Found the solution.
        First you need to fix typing errors in the vb script:
        Use (“) instead of (”) in the vb script by manually search and replace.”)
        In the ‘Uninstall Java(TM) 7 Update * , change Set colJava6dot to Set colJava7dot.
        Run this script separately to check that non of the lines have been split up.

        Then in the cmd you need to correct a couple of things:
        The ‘if’ comman has to be like this in a one liner:

        if exist %ProgramFiles(x86)% msiexec.exe /i %~dp0\Java7Update21_x64\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x64.log

        Finally, you should delete and add the equivalent regkeys for 64 bit system:

        reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wow6432Node\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f

        reg add “HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

        Now it runs on both systems and the program returns succesfully in sccm.

        The only thing that remains is to create something more because if you restart IE after the script has killed it, the java installation finishes without working and you’ll have to rerun it even if SCCM says it is succesfull.

        Cheers!

      • First of all a big thanks to Jesse for taking the time to publish this! I have had some problems though, some of which Rod has outlined. Thanks to Rod too.

        I have the same “error 255” issue which I hope Rods suggestion will fix.

        Also, could not get the regedits to run successfully so I created as separate batch file for that; Rod your suggested script looks to be missing something?

        I discovered the same thing about if you open a browser after it is killed and before the script finishes or completes to some point, the script will fail.

        I couldn’t get the original vb script to work do to the issues that come naturally with copying and pasting code from the web 🙂 I’m no coder so I had someone in my company re-write the vb script and add a log file. But it needs to be changed to create directory if it doesn’t exist and to pull information about the versions it uninstalled. Here that is:

        ‘——————————————————————————–
        ‘declare variables
        ‘——————————————————————————–

        Const ForAppending = 8

        Const LogFile = “c:\temp\javauninstall.txt”

        ‘——————————————————————————–
        ‘create log file
        ‘——————————————————————————–

        Set objFSO = CreateObject(“Scripting.FileSystemObject”)

        Set objLogFile = objFSO.CreateTextFile(LogFile)

        sLog = “Started Java Uninstall”

        Call WriteLog(sLog)

        ‘——————————————————————————–
        ‘start
        ‘——————————————————————————–

        On Error Resume Next

        strComputer = “.”

        Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

        ‘——————————————————————————–
        ‘Uninstall Java 2 Runtime Environment, J2SE Runtime Environment
        ‘——————————————————————————–

        sLog = “Uninstalling Java 2 Runtime Environment Standard Edition”

        Call WriteLog(sLog)

        Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java 2 Runtime Environment Standard Edition %'”)

        For Each objSoftware in colJava4dot3

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘Uninstall Java 2 Runtime Environment, J2SE Runtime Environment
        ‘——————————————————————————–

        sLog = “Uninstalling J2SE Runtime Environment”

        Call WriteLog(sLog)

        Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘J2SE Runtime Environment %'”)

        For Each objSoftware in colJava4dot3

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘Uninstall Java 2 Runtime Environment, SE *
        ‘——————————————————————————–

        sLog = “Uninstalling Java 2 Runtime Environment, SE”

        Call WriteLog(sLog)

        Set colJava4dot3 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java 2 Runtime Environment, SE %'”)

        For Each objSoftware in colJava4dot3

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘Uninstall Java(TM) 6 Update *
        ‘——————————————————————————–

        sLog = “Uninstalling Java(TM) 6 Update”

        Call WriteLog(sLog)

        Set colJava6dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) 6 Update %'”)

        For Each objSoftware in colJava6dot

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘Uninstall Java(TM) 7 Update *
        ‘——————————————————————————–

        sLog = “Uninstalling Java(TM) 7 Update”

        Call WriteLog(sLog)

        Set colJava7dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) 7 Update %'”)

        For Each objSoftware in colJava6dot

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘Uninstall Java(TM) 7 *
        ‘——————————————————————————–

        sLog = “Uninstalling Java(TM)”

        Call WriteLog(sLog)

        Set colJava7 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) %'”)

        For Each objSoftware in colJava7

        objSoftware.Uninstall()

        Next

        ‘——————————————————————————–
        ‘close log file
        ‘——————————————————————————–

        sLog = “Completed Java Uninstall”

        Call WriteLog(sLog)

        objLogFile.Close

        ‘——————————————————————————–
        ‘end
        ‘——————————————————————————–

        Wscript.Quit 0

        ‘——————————————————————————–
        ‘function
        ‘——————————————————————————–

        Function WriteLog(sLog)

        objLogFile.writeline Now() & ” – ” & sLog & vbCrLf

        objLogFile.Close

        sLog = null

        Set objFSO = CreateObject(“Scripting.FileSystemObject”)

        Set objLogFile = objFSO.OpenTextFile(LogFile, ForAppending)

        End function

  3. You were both right on the 64 BIT install command line. It now returns succesful, which I like, but is it truely successful 😉

    Will keep an eye on this thread as I think we could have an even more refined solution.

    Once again, thanks for publishing Jesse!

  4. What would be great is if someone can come up with a simple cmd pop-up that asked the end user to “do not re-open browser until this window closes”. Im a rookie at this so someone else could probbaly do a better job at it.

  5. I came up with this added to the java_install.cmd and it works locally but doesnt seem to work through SCCM?

    Maybe someone can help:

    START CMD /C “ECHO This is your message && PAUSE”

  6. Thanks for posting this. Having some issues with the script. Earlier Jesse you commented this:

    Note that it is very important to configure your script to point to the sub-directories that contain your Java .msi and .cab files.

    So where in my script do I add to point to these?

    • I think I can help.

      I believe he is referring to the point in the script that calls for the install; be sure THAT has the correct path where you have the install package on your SCCM server.

      Set it up, folder structure and all just like Jesse and you should be ok.

      I had to replace all of the single/double quotes and a few BS characters once I copied it down from this site. Just make a close comparison.

      If you can get a pop-up Window working to notify the client what is happening and not to open browser until complete (or 5 minutes or so) THAT would be great! Especially since we will be doing this every few weeks! LOL

      I can get one (pop-up cmd window) to run when I run the script locally, just not pushing through SCCM. 😦

  7. Hi,
    My Java deployment is now Complete.
    I use this tool prior to the Java installation: http://blog.coretech.dk/kea/new-version-of-the-coretech-shutdown-tool/
    Latest Version is found here: http://blog.coretech.dk/download/ShutdownTool-0.9.2BETA6.zip

    I’ve also made som more modification to the cmd script where the initial section is Completely New:

    @echo off
    cls
    echo ——————————————————–
    echo .
    echo . Installing Java 7 Update 25
    echo . All your internet browsers are closed during the installation.
    echo . Please don’t open any internet browsers until this window closes.
    REM Installs Java 7 Update 25 and disables autoupdate
    echo .
    echo ——————————————————–

    @echo off

    tasklist /nh /fi “IMAGENAME eq iexplorer.exe” 2>NUL | find /i /N “iexplorer.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM iexplorer.exe

    tasklist /nh /fi “IMAGENAME eq iexplorer.exe” 2>NUL| find /i /N “iexplore.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM iexplore.exe

    tasklist /nh /fi “IMAGENAME eq firefox.exe” 2>NUL | find /i /N “firefox.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM firefox.exe

    tasklist /nh /fi “IMAGENAME eq chrome.exe” 2>NUL | find /i /N “chrome.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM chrome.exe

    tasklist /nh /fi “IMAGENAME eq javaw.exe” 2>NUL| find /i /N “javaw.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM javaw.exe

    tasklist /nh /fi “IMAGENAME eq jqs.exe” 2>NUL | find /i /N “jqs.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM jqs.exe

    tasklist /nh /fi “IMAGENAME eq jusched.exe” 2>NUL | find /i /N “jusched.exe” >nul
    if “%ERRORLEVEL%”==”0” taskkill /F /IM jusched.exe

    This modification of the taskkill is made to avoid the error Messages when it tries to kill process that are not running since the cmd Windows is visible.

    So what basically happens, is that the java deployment is run with a dependency.
    It will first run the shutdowntoll where the users are notified about the installation and where they can postpone it or shut Down listed Applications as IE, Firefox and Chrome.
    When it’s done, the java deployment starts instantly with visible a command Window telling the users that they must not open any browsers while the installation is running. (it fails then).

    In SCCM you need to create a separate package for the shutdowntool with the program that is used prior to JAVA install.

    I’ve modified the shutdowntool to run with Our Company logos, and with a exceed limit of a 8 hours in case their work is business Critical.

    I would like to share both images of the settings in SCCM and all the Source files with you but is not easy on this blog.

    Jason, can you manage to build in some plugins so I can share alle the good stuff with you?

  8. Thanks for the posts this looks like a good solution to updating Java across an estate, the only problem i am having is that on a 32bit machine it will install Java 32 bit and on a 64 bit machine it will install Java 64 bit but on quite a few of our 64 bit machines we still run a 32 bit IE so would need to install a 32 bit Java. Do you know any way to instill some logic into the install to query the current Java install and update it with the same version instead of just assuming that 64 bit clients need 64 bit Java?

    • If you run this on 32 bit it installs 32 bit. If you run it on 64 bit it actually installs both 32 bit and 64 bit java!
      Remember “if exists” ….

      Try it out

  9. Think this should work nicely.

    @ECHO OFF

    taskkill /F /IM iexplorer.exe
    taskkill /F /IM iexplore.exe
    taskkill /F /IM firefox.exe
    taskkill /F /IM chrome.exe
    taskkill /F /IM javaw.exe
    taskkill /F /IM jqs.exe
    taskkill /F /IM jusched.exe

    REM Check if 32bit of 64bit OS
    IF %PROCESSOR_ARCHITECTURE% EQU AMD64 GOTO x64
    IF %PROCESSOR_ARCHITECTURE% EQU x86 GOTO x86

    :x64

    cscript %~dp0Java7_Uninstall.vbs
    msiexec.exe /i %~dp0\Java7Update21_x86\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x86.log
    reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f
    reg add “HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

    GOTO END

    :x86

    cscript %~dp0Java7_Uninstall.vbs
    msiexec.exe /i %~dp0\Java7Update21_x86\jre1.7.0_21.msi /passive /norestart /l*v c:\windows\temp\Java7x86.log
    reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f
    reg add “HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

    GOTO END

    :END
    EXIT /B %EXIT_CODE%

  10. how are you guys handling the user sitting at his laptop working and then SCCM kicks in and closes what ever he’s doing in his browser(s)? Shouldn’t we be considering this? I might’ve spent 30 minutes filling out some online form of some sort and then bloody Java install closes my browser and I loose my work..
    how do we handle this?

  11. Might I suggest that you gather what ever suggestions were made in this post and add it to your own.. and for gods sake… make it a downloadable file… I had to edit a lot of stuff in the script to “convert” it back to vbs from what ever editor this blog uses 🙂

  12. Use a transform file (MST) via ORCA and be done with it. You guys complicate it way more than it needs to be. You also do not need to deploy the x64 version unless you’re using a 64-Bit Web Browser…..which almost nobody is. x86 for all platforms at this point, realistically.

  13. Pingback: » Anders Rodland's Blog

  14. Great job, this was very help full, I did do some changing with variables:

    set x86dir=jre1.7.0_45_x86
    set x86msi=jre1.7.0_45.msi
    set x64dir=jre1.7.0_45_x64
    set x64msi=jre1.7.0_45.msi

    REM Install JRE x86
    msiexec.exe /i %~dp0\%x86dir%\%x86msi% /quiet /norestart

    REM Install JRE x64
    if exist %ProgramFiles(x86)%
    msiexec.exe /i %~dp0\%x64dir%\%x64msi% /quiet /norestart

    I also added this to the end to remove the start menu BS that was introduced in 7U40:

    rmdir “%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Java” /S /Q

    Thanks again, though, this was very helpful!

  15. Ok, I have I have revisited this about 12 times. I cleaned up the x64 detection method to be a little more methodical. I am now using this script:

    @ECHO OFF
    setlocal ENABLEEXTENSIONS

    set x86dir=jre1.7.0_45_x86
    set x64dir=jre1.7.0_45_x64
    set msi=jre1.7.0_45.msi

    ::Enumerate OS Architecture
    set KEY_NAME=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    set VALUE_NAME=PROCESSOR_ARCHITECTURE

    FOR /F “usebackq tokens=3” %%A in (`REG QUERY “%KEY_NAME%” /v “%VALUE_NAME%” 2^>nul ^| find “%VALUE_NAME%”`) DO (
    set OS_ARCH=%%A
    )

    ::Install JRE x86
    msiexec.exe /i %~dp0%x86dir%\%msi% /quiet /norestart IEXPLORER=1

    ::Install JRE x64
    IF “%OS_ARCH%”==”AMD64” (
    msiexec.exe /i %~dp0%x64dir%\%msi% /quiet /norestart IEXPLORER=1
    )

    ::Disable autoupdating
    reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f
    reg add “HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

    ::Remove Start Menu shortcuts
    rmdir “%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Java” /S /Q

    ::Return exit code
    exit %ERRORLEVEL%

    • Why not just use the %processor_Architecture% variable to determine the OS type?

      Much quicker and cleaner and I have been using this with success for a long time.

  16. Pingback: Deploying Java with SCCM 2012 | Cavarpe Technology Blog

  17. I am getting 0xFF(255) The extended attributes are inconsistent I have placed REM infront of the x64 lines in the cmd. Any ideas as the software installs correctly on the client, it is just reporting incorrectly to SCCM
    Here is the script
    @echo off

    taskkill /F /IM iexplorer.exe

    taskkill /F /IM iexplore.exe

    taskkill /F /IM firefox.exe

    taskkill /F /IM chrome.exe

    taskkill /F /IM javaw.exe

    taskkill /F /IM jqs.exe

    taskkill /F /IM jusched.exe

    REM Call the uninstall script

    cscript Java_Uninstall.vbs

    REM Install JRE x86

    msiexec.exe /i Java7Update45_x86\jre1.7.0_45.msi /passive /norestart /l*v c:\windows\temp\Java7x86.log

    REM Installing JRE x64

    REM if exist %ProgramFiles(x86)% msiexec.exe /i Java7Update45_x64\jre1.7.0_45.msi /passive /norestart /l*v c:\windows\temp\Java7x64.log

    REM Disable automatic updates

    reg delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” /v SunJavaUpdateSched /f

    reg add “HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 0 /f

    REM Return the exit code to SCCM

    exit /B %EXIT_CODE%

    • Hi,

      For Java I use:
      shutdowntool_NoBack.exe /ps:”iexplore.exe”*”Internet Explorer”:”firefox.exe”*”Firefox”:”chrome.exe”*”Google Chrome” /t:900 /m:480 /d:”We are installing a new JAVA version. Please shut down all your internet browsers” /c

      • Hello Rodrigo Lopez

        Thank you for all the help you have supplied in this forum. Would you provide more detail about how you configured the Shutdowntool and SCCM? I did look at the screen shots in your uploaded files. Does the Shutdown Tool have to be downloaded onto all devices prior to updating Java? Does it all happen at the same time? I understand the pieces but I’m still a little confused about how you put it all together in SCCM.

      • Thanks. I think i got it figured out except for /ps: in the command line. That just does not seem to work on WIndows 8.1 Update 1

  18. Does anybody else have trouble with the uninstall vbscript not working? I’ve gone through and fixed all the web copy and paste errors and I’ve tried the version that Bubba Tex posted which writes log entries as it goes but I still can’t actually get it to uninstall java7u21.

    • Daflibble,I found a typo in Bubba Tex’s script. The section in his script that calls the uninstall for Java 7 Update is actually calling the variable for Java 6 update. So that section should look like this:

      ‘——————————————————————————–
      ‘Uninstall Java(TM) 7 Update *
      ‘——————————————————————————–

      sLog = “Uninstalling Java(TM) 7 Update”

      Call WriteLog(sLog)

      Set colJava7dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java(TM) 7 Update %'”)

      For Each objSoftware in colJava7dot

      objSoftware.Uninstall()

      Next

      However, I found in practice that it still didn’t work for me, I’m thinking the name section has changed. What I ended up doing is this:

      ‘——————————————————————————–
      ‘Uninstall Java ALL*
      ‘——————————————————————————–

      sLog = “Uninstalling Java(TM) 7 Update”

      Call WriteLog(sLog)

      Set colJava= objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java%'”)

      For Each objSoftware in colJava

      objSoftware.Uninstall()

      Next

      This section uninstalls everything Java related on the computer, and in my testing it uninstalled the version 7 ones that wouldn’t uninstall with the previous script.

  19. Greetings! This is my first visit to your blog! We are a team of volunteers
    and starting a new project in a community in the
    same niche. Your blog provided us useful information to work on. You
    have done a wonderful job!

  20. Daflibble I was haveing the same issues i changed the java 7 uninstall lines to

    Set colJava7dot = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java%Update %'”)
    and
    Set colJava7 = objWMIService.ExecQuery(“Select * from Win32_Product Where Name like ‘Java%'”)
    and now it uninstals

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s