Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 15907
  • Last Modified:

Uninstall Java 32bit and 64bit using command line

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
Techie_Guru
Asked:
Techie_Guru
  • 3
  • 2
1 Solution
 
PaulNSWCommented:
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
 
Techie_GuruAuthor Commented:
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
 
PaulNSWCommented:
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
 
Techie_GuruAuthor Commented:
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
 
Techie_GuruAuthor Commented:
Found and removed all versions and editions of java without any errors.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now