How to find computers running an old version of Java 7

Shane head shot
Shane Corellian|Updated May 12, 2021
How to find computers running an old version of Java 7
How to find computers running an old version of Java 7

Which Java versions are on my network?

Let’s find all the Windows computers on our network that have an old version of Java 7.

Download this zipped collection. Unzip it and import the java.xml into your PDQ Inventory console. (From PDQ Inventory, File > Import).

In this example we are using PDQ Inventory 2.0 Release 3.

After you import the collection (and scan your computers) you’ll see which computers have Java 7, and which of those are running an older version.

All done. You can stop reading unless you want to see how we created the collection. (It’s pretty cool stuff and you’ll probably get some ideas for other collections in PDQ Inventory that you want to create.)

Creating the Java collections in PDQ Inventory

These collections may be a little more complex than you are used to. This is due to the way that Oracle lists the installed Java applications names. Most collections won’t be this tricky. This collection will also involve sub (or Child) collections.

It is also important that your computers have received a recent Inventory scan. If they haven’t been scanned in a while, take a few minutes to initiate a scan.

Create a new dynamic collection called “Java 7”

In this collection add an Application filter. In this filter populate the following Comparisons. Name STARTS WITH Java

Version starts with 7

Close this Collection.

Java 7 Collection

Create a sub-collection

To do this, right-click on your new Java 7 collection and select New Dynamic Collection. This will make a sub collection. Call it something like: Java 7 32-bit (Old Version). Add an Application filter. You will use two comparisons again but they will be slightly different than the first collection.

Name matches expression ^java\(tm\) 7(?!.*64)|^java 7(?!.*64)

Version version between 7 and 7.0.100

Java 7 32 bit Collection

 Go ahead and close the new collection. This collection should now include computers that are running 32-bit Java 7 Update 10 or below.

Create another dynamic collection under Java 7

Call this one Java 7 64-bit (Old Version)

Using the Application filter use the following comparisons:

Name matches expression ^java\(tm\) .+\(64-bit\)|^java .+\(64-bit\)

Version version between 7 and 7.0.100

Java 7 32 bit Collection

Close the collection.

Your collections should look something like this.

Collection Structure

It’s important to remember that when Oracle releases the next Java Update you will need to modify your Version comparisons to reflect the new version.

Now you know which computers needs to be updated with the latest update of Java 7. If you are using PDQ Deploy then you can download the Java 7 Update 11 package. Then, simply right click on Java 7 32-bit (Old Version) collection and select Tools > PDQ Deploy. When the Select Package window appears simply select the Java 7 Update 11 package and say OK. The Deploy Now window will automatically be populated with the machines which have an old version of 32-bit Java. Repeat on the 64-bit collection using the 64-bit Package from PDQ Deploy.

Extra credit

If you would like to understand the Regular Expressions that we used in this example please read on.

In the 32-bit collection we used the Name matches expression comparison in the Application filter:

^java\(tm\) 7(?!.*64)|^java 7(?!.*64)

We need to use this so that this collection doesn’t include computers that only have an old version of 64-bit Java. Notice that we also have to prepare for the application name to start with either “Java(TM) 7” or “Java 7” since early versions of Java 7 included the (TM) in the name. The later updates have removed (TM).

I will quickly break down what this regular expression is doing:

^java\(tm\) 7 means that the application name needs to start (^) with the characters: Java(TM) 7. But if we stopped here we would have some problems because this would match systems running either 32-bit Java 7 or 64-bit Java 7. Why? Because of how Oracle stores the application names. Here are two examples of how Oracle stores the Java name for Java 7 Update 11.

For 32-bit: Java 7 Update 11

For 64-bit: Java 7 Update 11 (64-bit)

Here is a computer which has two installations of Java 7. One is 32-bit (up to date) and one is 64-bit (needs to be updated).

Collection Structure

So the question is how do we NOT include computers that only have a 64-bit version? We use what is known as a Negative Lookahead (?!) to exclude any string that contains the numbers 64 after Java(TM) 7.

The expression “^java\(tm\) 7(?!.*64)” would match the following examples

Java(TM) 7 Update 1

Java(TM) 7

But it would NOT match

Java(TM) 7 Update 1 (64-bit)

Anytime you see a regular expression with a PIPE | this means OR.

^java\(tm\) 7(?!.*64)|^java 7(?!.*64)

With the Pipe symbol you can say OR match xxx. Since some Java names start with “Java(TM) 7” and others start with “Java 7” we need to be able to match either.

Note that since the name Java(TM) includes parentheses (which are considered special characters in expressions) we need to escape them with a preceding backslash in order to properly evaluate. That is why the (TM) looks like \(tm\).

Also note how Oracle stores the Java versions.

7.0.0  – Java 7 with no updates

7.0.10 – Java 7 Update 1

7.0.90 – Java 7 Update 9

7.0.100 – Java 7 Update 10

7.0.110 – Java 7 Update 11

When we use Version version between 7 and 7.0.100 we are saying “show me versions from Java 7 through Java 7 Update 10”.

The expression that we used with the 64-bit collection was slightly different.

^java\(tm\) .+\(64-bit\)|^java .+\(64-bit\)

We aren’t using a negative lookahead we are simply stating that the characters “(64-bit)” must be in the string after Java or Java(TM).

That’s it. Simple, huh?

Shane head shot
Shane Corellian

Shane is the co-founder of PDQ.

Related articles