There are tons of older posts on this and nothing that is cut and dry. What is the best way to remove all versions of Java?
Answer Summary:
run on the system the following command: wmic product where "name like 'java%%'" call uninstall It can be automated.
Cancel
1 Comment   [ + ] Show Comment

Comments

  • You may check the powershell command to do the same

    $computers = Get-Content "C:\temp\computers.txt"

    ForEach-Object ( $computer in $computers ) {


    $java = Get-WmiObject -ComputerName $computer Win32_Product | WHERE { $_.name -like "J2SE Runtime Environment*" }
    $java.uninstall()

    }

    Thanks
    Joe
Please log in to comment

Answer Chosen by the Author

4
run this command:
wmic product where "name like 'java%%'" call uninstall

I do this as a KACE Script, following the installation of the most current Java version (or better the latest approved ;) )

Answered 08/13/2015 by: Nico_K
Red Belt

Please log in to comment

Answers

0
You may try the powershell script that i found on other forum

$computers = Get-Content "C:\temp\computers.txt"ForEach-Object ( $computer in $computers ) {    $java = Get-WmiObject -ComputerName $computer Win32_Product | WHERE { $_.name -like "J2SE Runtime Environment*" }    $java.uninstall()    }
Answered 08/14/2015 by: Joe Prior
Orange Belt

Please log in to comment
0
The WMIC can work perfect indeed, but the win32_PRODUCT function is very buggy and slow.
And sometimes can trigger unwanted repairs, so just as a plan B:
You go over the registry path HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall and search for every hit on *JAVA* and then call the uninstall registry string (uninstallstring) in that key.
Because all software is registered there under there GUID code.

Here is a batch example



Answered 08/17/2015 by: dedenker
Third Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity