Identifies and uninstalls Oracle's Java software from the local machine using WMI. The query to locate the installed software interogates the WIN32_Products class and includes exclusions to avoid matches to third party software that has "Java"
in it's name.
Use the -KeepVersion argument to specifiy a version to keep installed on a computer.
Use the -Whatif switch to test the result without actually uninstalling anything.
See the documentation page for a full list of options and their descriptions
The script will return the results of the WMI query as an object array.
Credit to commenter on my blog "Carsten" who supplied an expanded list of software to exclude.
Note: this script is supplied "as is" and has not been fully tested for all possible scenarios. Use at your own risk and do full testing before using in production.
Full blog post here