Jump to content

Recommended Posts

Posted

Hello Guys,

 

I'm currently messing about with PowerShell, trying to make our lives easier with diagnosing problems on the network. One idea I had was to develop a script that would check remote machines to see what version of Adobe Flash Player and Java they had installed and compare this with the latest version available on the web. Has anyone attempted to create a PowerShell script that does this or know of one that accomplishes this?

 

Many thanks.

  • 2 months later...
Posted
Has anyone attempted to create a PowerShell script that does this or know of one that accomplishes this?

Not sure if you still need it, but I came across this script for Java today.

 

Workflow Get-Java7Version {

   [cmdletbinding()]

   param(

       [psobject[]]$Computers
   )

   foreach -parallel ($computer in $computers) {

       Write-Verbose -Message "Running against $($computer.Name)"

       # Check each computer for the info.

       $versions = Get-WmiObject -Class CIM_Datafile `

       -Filter '(Name="C:\\Program Files\\Java\\jre7\\bin\\java.dll" OR Name="C:\\Program Files (x86)\\Java\\jre7\\bin\\java.dll")' `

       -PSComputerName $computer.ipv4address -ErrorAction SilentlyContinue | Select-Object -Property Name,Version

       if ($versions){

           # Process each version found

           Write-Verbose -Message "Java found on $($computer.Name)"

           foreach($version in $versions){

               # Create a Custom PSObject with the info to process

               $found = InlineScript {

                   New-Object –TypeName PSObject –Prop @{'Computer'=$Using:computer.Name;

                   'IPv4Address'=$Using:computer.ipv4address;

                   'File'=$Using:version.name;

                   'Version'=$Using:version.version}

               }

               # Return the custom object

               $found

           }

       }

       else {

           Write-Verbose -Message "Java not found in $($computer.Name)"

       }

   }

}

 

Import-Module ActiveDirectory

$computers = Get-ADComputer -Filter * -Properties Name,OperatingSystem,IPv4Address | Select-Object Name,IPv4Address

Get-Java7Version -Computers $computers -Verbose | Select Computer,IPv4Address,Version,File | Out-GridView

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...