Solved

Uninstall Java 32bit and 64bit using command line

Posted on 2013-06-10
5
13,008 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
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…

777 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