A VBScript to uninstall Java Runtime Environments

The following script can be used to uninstall all versions of Java on a computer.
 
Please note:

  • Script was found here: AppDeploy / ITNinja
  • Original article was found here: Mockbox
  • Some versions of Java cannot be uninstalled silently (e.g. Version 6 Update 20)
  • Script needs to be ran from the command line (usage examples below)

 
WARNING:
Uninstalling Java can be troublesome. Some versions do not want to be uninstalled silently (e.g. by a script or command) and some may half uninstall resulting in a somewhat impaired computer. I strongly suggest you thoroughly test this script in your environment before deploying to production computers.
 

How do I use the script?



 
Download JavaUninstallScript.vbs or copy the code in the below section "JavaUninstallScript.vbs Code" into notepad and save the file as JavaUninstallScript.vbs

  • If running on the local computer
    1. Open the command line as Administrator (Right click on 'Command Prompt' in the start menu and select 'Run as administrator')
    2. Navigate to where the JavaUninstallScript.vbs was saved to
    3. Run the command which best suits you
  • If running from Configuration Manager (ConfigMgr /  SCCM)
    1. Copy the script to your package share
    2. Create the package
    3. Set the program command as

 

Usage Examples:



 
Keeps all Java Runtimes. Only useful for making a list of installed runtimes

 
 
Removes all Java Runtimes without creating logs

 
 
Removes all Java Runtimes found except Java 6 Update 24 and J2SE 5 Update 16 and places the uninstall logs in C:\Temp

 
 
Removes all Java Runtimes found except x64 Java 6 Update 24 and x86 J2SE 5 Update 16 on a x64 system and places the uninstall logs in C:\Temp

 

JavaUninstallScript.vbs Code



 

Leave a Comment

  • Info

    I typically try and keep the blog up-to-date but apparently I'm not very good at posting!