404 Tech Support

PowerShell Script to update Adobe Flash Player that avoids IE

Pushing out Adobe Flash Player updates through a startup script got a little more complicated with Windows 8. For IE11 on Windows 8, Adobe Flash Player is updated through Windows Updates. Pushing the update out through a startup script for Windows 7 works just fine for the ActiveX and Plugin installs but on Windows 8+, the IE Adobe Flash Player update can hang and keep Windows Installer open the whole time.

To work around that limitation, the following PowerShell script will check the OS name to see if it contains “Windows 8”. If it does, it will install just the Adobe Flash Player update for plugin-based browsers like Firefox. If it does not match, it will install both the ActiveX and plugin version of the Adobe Flash Player. The script is pretty simple and straight-forward. It uses a receipt hosted on a server share to see if the update has been installed already while grabbing the latest installer from a different folder on the same server share.

# Adobe Flash update at startup script
# Jason Hamilton

$cn = $env:COMPUTERNAME
$receipt = [string]::concat("\server.fqdnsharereceiptsUpdatesFlashplayer", $cn, ".txt")

# Check if receipt exists. If so, exit
If (Test-Path $receipt){
# Receipt exists, update not needed

} else {

# Timestamp
$timestamp = get-date -f "MM/dd/yyyy HH:mm"

# Check Windows version
$osname = $(gwmi win32_operatingSystem).caption
$win8 = $osname.Contains("Windows 8")
if ($win8) {
# Install just Plugin Flash Player
msiexec /i \server.fqdnshareUpdatesFlashplayerlatest_flash_plugin.msi /passive

# Write receipt of install completed
Write-Output "Flash Player (Plugin) installed $timestamp" | Out-File -FilePath $Receipt -encoding ascii

} else {

# Install ActiveX and Plugin Flash Player
msiexec /i \server.fqdnshareUpdatesFlashplayerlatest_flash_activex.msi /passive
msiexec /i \server.fqdnshareUpdatesFlashplayerlatest_flash_plugin.msi /passive

# Write receipt of install completed
Write-Output "Flash Player (IE and Plugin) installed" $($timestamp) | Out-File -FilePath $Receipt -encoding ascii
}
}
exit