?
Solved

Powershell - Script Java JRE Upgrade

Posted on 2014-08-25
3
Medium Priority
?
1,418 Views
Last Modified: 2014-09-17
I currently run the Java JRE on my 2000+ workstations.  Unfortunately, I don't have a good enterprise deployment method for Java.  Historically, I have relied on the version that would have been installed upon image deployment to last the OS through its lifetime in the enterprise.  Once the machine needs to be reimaged, a new version of Java will be installed as part of the imaging process.  This has worked well, until now.  I have now been informed that the version of my JRE on the majority of my machines is too old to support a business application that is widely used.  I'm now faced with the question of how to update many older versions of Java to something more recent.

I'm thinking that a Powershell script might be the way to go, as this is my language of choice.  Would it be possible to pull a value from the registry into a variable that would then allow me to uninstall an old version?  I have many different updates of Java 7 installed in my enterprise, so not all machines will have the same versioning.  I then need to script an unattended install of Java 7.65 (or newest version) to upgrade the machines.  In my experience, the Java installer does not replace old versions, it only installs two versions side-by-side.

What would be the best way to conquer this task?
0
Comment
Question by:marrj
2 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 40284109
I would say an easy route would be querying the registry for the version value you need.

If the version is less than the current expected version then copy and run the msi that you would use to install the latest version.


If you can give me an example of the output from a computer where you query for the version installed. maybe I can give more details.
0
 
LVL 41

Accepted Solution

by:
footech earned 2000 total points
ID: 40285015
In my experience, an installation of Java will upgrade an existing installation if:
- the major version number is the same (i.e. 1.7_65 will upgrade 1.7_17)
- and if the previous install is in the default path.  I can't remember the terms that Oracle uses to describe this, but there are two types of install: one using the generic/default path (like "C:\Program Files (x86)\Java\jre7"), and another using a version-specific path (usually meant for installing multiple versions or when an app is dependent on a specific version being installed).

You may test out deploying via Group Policy Software Deployment.  To do so you will have to extract the .MSI.
http://www.java.com/en/download/help/msi_install.xml
You can then push out updates in the same way.  May not help you with cleaning up old versions, but would probably be a good path moving forward.  I've played around with this before, and it seems to fit your scenario.  Perhaps pushing out the latest, and then running the Java Uninstall Tool (but that would require user intervention).
http://www.java.com/en/download/faq/uninstaller_toolinfo.xml
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month17 days, 3 hours left to enroll

864 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