Package Request - Java SE Development Kit Uninstaller (all versions)

Completed

Comments

5 comments

  • Official comment
    Chris James

    Yikes, this took a while to get published, but it is finally available! 

     

    Enjoy! ...?

    Comment actions Permalink
  • Chris James

    Hello Jeff, thanks for submitting this request.

    We are considering including this uninstaller in the Package Library. While this is under testing internally, I wanted to reach out and show you how I was able to create a package using PowerShell to uninstall the Java SE Development Kit back to version 6.

    This will not remove the associated JRE. We have a package for that in the Package Library.

    If you’re up to give this a go in your test environment, here’s the PowerShell I used to remove JDK:

    # Uninstalls Java SE Development Kit

    ForEach ( $Architecture in "SOFTWARE", "SOFTWARE\Wow6432Node" ) {

      $UninstallKey = "HKLM:\$Architecture\Microsoft\Windows\CurrentVersion\Uninstall"

      $GUIDKey = ( Get-ItemProperty "$UninstallKey\*" -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -clike "Java* SE Development Kit*" } ).PSChildName

          ForEach ( $GUID in $GUIDKey ) {

              If ( $GUID -ne $null ) {

                  Write-Output "Uninstalling: $(( Get-ItemProperty "$UninstallKey\$GUID" -ErrorAction SilentlyContinue ).DisplayName)"

                  Start-Process -Wait -FilePath "MsiExec.exe" -ArgumentList "/X $GUID /qn /norestart"

        }

      }

    }

     

    From there, create a PowerShell step and place the above into that step, make sure to correct any formatting. I'm not sure if the forum will display the code correctly. You can also insert a .PS1 containing the above as well. 

    Let us know if this works in your environment, or if you come up with any issues.

    Thanks again!

    0
    Comment actions Permalink
  • Christian Bacher

    Use this cmd command:

    wmic product where "name like 'Java SE Development Kit%%'" call uninstall

     

    Powershell is a powerfull tool but it makes many simple cmd commands to complex.
    Remember the KISS rule: Keep It Simple Stupid )

    0
    Comment actions Permalink
  • Chris James

    Hey Christian, thanks for the suggestion. I agree wmic is very handy, for legacy systems, but we find those commands to run much slower.

    In addition, Java 6 had a different naming format. You would need to run 2 separate commands to query wmi for the uninstall.

    0
    Comment actions Permalink
  • Jeff Lamb

    Hi gang

    I am fighting with SMBv1 issues :-(
    Just opened a support ticket on that issue

    I will try to get some time by the end of the week to test this process

    many thanks

    0
    Comment actions Permalink

Please sign in to leave a comment.