Share via


Script to Detect Java Version on a list of machines !

Question

Sunday, November 9, 2014 12:45 PM

I want to know the version of Java installed on a number of remote machines stored in a text file.

I googled it and found some scripts but the path of java is hard coded in them and they do not tell if Java is not installed at all.

Any help with an example would be greatly appreciated. 

Thanks, Yeleshwar

All replies (7)

Sunday, November 9, 2014 2:40 PM ✅Answered | 1 vote

No output no java.

Get-AdComputer |
     %{Get-WmiObject Win32_Product -filter "Name like '%java%'" -computer $_.Name}

¯\(ツ)_/¯


Sunday, November 9, 2014 12:54 PM

Java doesn't have t be installed..  It can just be there and be used by an application.  YOu can have many versions of java all running at the same time.

You need too clarify what you are looking for.

This will find classic java installs remotely.

Get-WmiObject Win32_Product -filter "Name like '%java%'" -computer PC1

¯\(ツ)_/¯


Sunday, November 9, 2014 1:03 PM

It did not work. Am I missing something ?

Thanks, Yeleshwar


Sunday, November 9, 2014 1:14 PM

It did not work. Am I missing something ?

Thanks, Yeleshwar

How do you know it didn't work?

¯\(ツ)_/¯


Sunday, November 9, 2014 1:16 PM

Here - there was a typo in my original.  I can see you do not know PowerShell.

Get-WmiObject Win32_Product -filter "Name like '%java%'" -computer PC1

¯\(ツ)_/¯


Sunday, November 9, 2014 2:33 PM

Thanks but this solution is not feasible. I have to supply multiple remote names and on many machines I will get different issues like Firewall, DCOM, RPC etc.. 

Moreover, it takes very long to execute and sometimes returns prompt without any output.  

Thanks, Yeleshwar


Sunday, November 9, 2014 2:34 PM

Sorry about the last line, when it returns no output means no Java was found on machine :)

Thanks, Yeleshwar