Quantcast
Viewing latest article 31
Browse Latest Browse All 120

Get flash version with PowerShell

Inventory of software is always fun to do.
I found myself wanting to do an inventory of the versions of Flash that were installed on all systems, so I went to my favorite tool: PowerShell.
When you install Flash at the default location,you can query the version of the file.
With this in mind, I wrote the following function:

function Get-FlashVersion {
    [CmdletBinding()]
    param(
        [parameter(mandatory=$false,position=0,valuefrompipelinebypropertyname=$true)]$ComputerName=$env:ComputerName
    )
    begin {
    } process {
        if(Test-Connection $Computername -count 1 -ErrorAction SilentlyContinue) {
            $filename = "\\$ComputerName\c$\windows\system32\macromed\flash\flash*.ocx"
            if(Test-Path $filename) {
                $file = Get-Item $filename
                $version = $file.versionInfo.fileversion -replace ",","."
            } else {
                $version = "Not Installed"
            }
        } else {
            $Version = 'Offline'
        }
        New-Object -TypeName PSObject |
        Add-Member -MemberType NoteProperty -Name 'ComputerName' -Value $ComputerName -PassThru |
        Add-Member -MemberType NoteProperty -Name 'FlashVersion' -Value $version -PassThru
    }
}

Viewing latest article 31
Browse Latest Browse All 120

Trending Articles