none
check java version using powershell RRS feed

  • Question

  • Hi 

    I need to check java version using powershell in window server 2012 r2. I got  a method in technet itself but its not working. Please suggest some useful method

    Sunday, January 15, 2017 6:09 PM

Answers

  • Hi,

    This command works for me

    Get-WmiObject -Class Win32_Product -ComputerName localhost -Filter "Name like 'Java%'" | Select -Expand Version


    Best regards, Kjetil :) Please remember to click "Mark as Answer" on the post that helps you. This can be beneficial to other community members reading the thread.

    My blog

    Sunday, January 15, 2017 6:34 PM
  • ... or you could use CIM
    Get-CimInstance -ClassName CIM_Product -Filter "Name like '%java%'"


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Sunday, January 15, 2017 6:37 PM

All replies

  • Hi,

    This command works for me

    Get-WmiObject -Class Win32_Product -ComputerName localhost -Filter "Name like 'Java%'" | Select -Expand Version


    Best regards, Kjetil :) Please remember to click "Mark as Answer" on the post that helps you. This can be beneficial to other community members reading the thread.

    My blog

    Sunday, January 15, 2017 6:34 PM
  • usualy you can simply run the command line
    java -version
    You just have to parse the output.

    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Sunday, January 15, 2017 6:35 PM
  • ... or you could use CIM
    Get-CimInstance -ClassName CIM_Product -Filter "Name like '%java%'"


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Sunday, January 15, 2017 6:37 PM