Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Completed

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

Can i possibly request an uninstaller (much like that you have developed for JRE) that can be pushed out to uninstall all Java SE Development Kit?

Many thanks
Jeff

0

Comments

5 comments
Date Votes
  • Official comment

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

     

    Enjoy! ...?

  • 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
  • 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
  • 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
  • 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