This can be run on all computers in the domain or you could specify the OU to search. This script will output to a tab delimited file named get_flash_version_output.txt by default but you can specify your own output file if desired. Here's the code:
[CmdletBinding()]
param(
$searchbase = $null,
$output = ".\get_flash_version_output.txt"
)
# if the searchbase isn't specified then use the default domain of the user
if($searchbase -eq $null)
{
$searchbase = ([adsi]'').distinguishedName.ToString()
}
#load all computer objects into a variable
$computers = Get-ADComputer -SearchBase $searchbase -Filter * -SearchScope Subtree
#iterate through each computer object
foreach($computer in $computers)
{
$name = $computer.name
# test to be sure you can communicate with the machine, ignoring any errors
if(Test-Connection $name -count 1 -ErrorAction SilentlyContinue)
{
# file that we will be querying for the version
$filename = "\\$name\c$\windows\system32\macromed\flash\flash*.ocx"
# test the path to be sure it exists before trying to check the version
if(Test-Path $filename)
{
$file = get-item $filename
$version = $file.versionInfo.fileversion -replace ",", "."
}
else
{
$version = "Not Installed"
}
write-verbose "$name`t$version"
"$name`t$version" | out-file -append $output
}
else
{
write-verbose "$name`tOffline"
"$name`tOffline" | out-file -Append $output
}
}
Generic execution which will iterate through your whole domain and output to get_flash_version_output.txt
PS C:\> .\get_flash_version.ps1
Execution specifying a specific searchbase within Active Directory
PS C:\> .\get_flash_version.ps1 -searchbase "dc=
Put it all together -> use searchbase, verbose output, and write to a different output file
PS C:\> .\get_flash_version.ps1 -searchbase "dc=
Another feature I'd like to add is maybe have it grab the current version of Flash from HERE and let you know if you need to upgrade or not.
But that is for another time….
How to check the adobe flash for n- number of computers?
ReplyDeleteHow to get a ouput file with computer name and version of adobe?
Please explain.