WMIC

Java Silent Update Part 1 – The Uninstall

Recently I was tasked with updating the organizations Java. With the help of some colleagues and Google, we were able to put together a fully functional and silent uninstall of all previous versions prior to installation of the newest version. In this edition, we will discuss the uninstall.

First, let me preface this caution as some of these commands can cause issues with running or install programs if proper testing is not performed prior to deployment.

The first step to uninstalling Java is stopping any programs that might currently be using the software. This is a starting point to which you can expand depending on the applications used in your environment.

taskkill /F /IM iexplorer.exe

taskkill /F /IM iexplore.exe

taskkill /F /IM firefox.exe

taskkill /F /IM chrome.exe

taskkill /F /IM javaw.exe

taskkill /F /IM jqs.exe

taskkill /F /IM jusched.exe

These commands will stop all the above processes instantly and without option to save. This can be used to force an install or prevent users from starting a program with installation is performed upon login.

Once all programs have been closed, you can proceed with uninstall of Java. There are two ways to proceed with the uninstall, targeted or complete. For a complete uninstall, run the following

wmic product where "name like 'java%%'" call uninstall /nointeractive

which will uninstall ALL versions of Java, both x86 and x64.

For a more focused and targeted uninstall, run the following

wmic product where "name like 'java%% 8%%'" call uninstall /nointeractive

which will uninstall ALL Java 8 version, both x86 and x64.

Please check back soon for part 2 in which we silently install the most recent version of Java, JRE8u65.

Tips are appreciated – BTC 1EiKhcZYRkapENTXmEXoYxdYheM1otuW7b

Tagged , , , , , , , , , , ,