Solved

Uninstall Java 32bit and 64bit using command line

Posted on 2013-06-10
5
13,976 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 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