Script to remove all versions of Java

Save the following as a batch script. I’ll let you work out the rest.

Eventcreate /L Application /T information /ID 69 /SO Remove-java.bat /D "Running J2SE Uninstall"
wmic product where "name like 'J2SE Runtime%%'" call uninstall /nointeractive
Eventcreate /L Application /T information /ID 69 /SO Remove-java.bat /D "Running Java(TM) Uninstall"
wmic product where "name like 'Java(TM)%%'" call uninstall /nointeractive
Eventcreate /L Application /T information /ID 70 /SO Remove-java.bat /D "Remove-Java.bat Completed"