Solved

Uninstall Java 32bit and 64bit using command line

Posted on 2013-06-10
5
12,501 Views
Last Modified: 2013-06-15
Hello,

I am currently responcible for making sure that my companies PC's have the latest and greatest patches and updates for all windows, adobe, and java applications. We have approximately 2000+ PC's and Laptops. I am trying to find an easier way to do a silent uninstall of all installed versions of Java. This includes uninstalling 32bit and 64bit editions in one scirpt. The script I was using before works great if the PC only has 32bit versions installed, but if a 64bit version is installed it doesnt work. I found out that I could use a command script to do this.

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

This would remove any and all editions/versions of Java, allowing me to install only the latest version. This worked for most of my PC's but on alot of them I get an ERROR: Description = Generic failure. This also happens when I try to run it manually on the PC. Is there a way to fix this or if someone knows how to create a VB script that will find and remove all versions of Java 32bit and 64bit in one pass?

We are using Windows 7 Enterprise 64bit. Please let me know if you need anymore additional detail in order to assist me to trying to find a solution for this.

Thank You,
AG
0
Comment
Question by:Techie_Guru
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:PaulNSW
ID: 39236954
This is what I used to removed all old Java versions.

There is a summary at
http://iampaulh.blogspot.no/2012/09/script-to-remove-all-java-plugins.html

with the main code coming from comments section at
http://www.itninja.com/question/silent-uninstall-java-all-versions
0
 

Author Comment

by:Techie_Guru
ID: 39239734
I will give this a try and let you know if it works.

Thank You for the links.


***Update***
The script didnt work. It looks to run succesfully but the old editions were still installed.
Any idea how to fix the WMIC command from having a generic error? I would perfer to use this method of uninstalling.
0
 
LVL 7

Accepted Solution

by:
PaulNSW earned 500 total points
ID: 39240174
What error code did you get when you ran the it in a command window?

I just tried it now, and it worked perfectly!

Copy the file to your computer (eg c:\scripts), open up an administrative command prompt then type

cscript "c:\scripts\javaremove.vbs" /logfilepath:"%userprofile%"

Open in new window


javaremove.vbs

You should get something like this:

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

**********************************
Java uninstall script started at 12/06/2013 08:02:10

----------------------------------
Script parameters:
Specified Java versions found will be kept. Other versions will be removed.
No native Java versions specified on the command line.
No x86 Java versions for x64 systems specified on the command line.
Using specified native verions for x86 also.
Uninstall log file path: c:\tools\.
----------------------------------

----------------------------------
Checking for problematic processes.
Finished problematic process check.
----------------------------------

----------------------------------
Found version: Java 7 Update 21 (64-bit)
Found at: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F86417021FF}
Uninstall string: MSIEXEC.EXE /X {26A24AE4-039D-4CA4-87B4-2F86417021FF} /qn /norestart /l*v "c:\tools\Java 7 Update 21 (64-bit)_Uninstall.txt"
Uninstall return code was: 0.
----------------------------------

----------------------------------
Found version: Java 7 Update 21
Found at: HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83217021FF}
Uninstall string: MSIEXEC.EXE /X {26A24AE4-039D-4CA4-87B4-2F83217021FF} /qn /norestart /l*v "c:\tools\Java 7 Update 21_Uninstall.txt"
Uninstall return code was: 0.
----------------------------------

Java uninstall script finished at 12/06/2013 08:02:27
**********************************

Open in new window

0
 

Author Comment

by:Techie_Guru
ID: 39250537
Thank you for the feedback. The script appears to work perfectly when I run it from command prompt. Is it possible to have it run silently? The issue I have now is trying to get it to work from Altiris Deployment Server.

I may have to figure this one out on my own but Thank You so much for that script. Does exactley what I needed.
0
 

Author Closing Comment

by:Techie_Guru
ID: 39250539
Found and removed all versions and editions of java without any errors.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Let’s list some of the technologies that enable smooth teleworking. 
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now