Deployment Script: Adobe Flash player 11.9.900.152

Topics: Archive - Deployment Scripts
Nov 20, 2013 at 9:10 PM
Edited Dec 2, 2013 at 2:42 PM
Hello All,
I just started working with PS App Deploy Toolkit and have very little Powershell experience. I do have a few years of application packaging and automating installations experience though. I really like this wrapper and am hoping this can become a good exchange of info for deploying packages so I am posting the packages I have recently worked on.

This particular script I could use some feedback on in determining if the OS is 32 or 64 bit.
  • Uninstalls previous versions of Flash Player
  • Script closed and sessions of IE, Chrome, or Firefox
  • Installs ActiveX and Plugin versions of Flash player 11.9.900.152
  • Copies a n MMS.cfg file that turns off auto updates for Flash to the correct locations 32/64 Bit
  • Uninstalls based on GUID of MSIs
***EDITIED with the suggestions from sintaxasn
<#
.SYNOPSIS
    This script performs the installation or uninstallation of an application(s).  
.DESCRIPTION
    The script is provided as a template to perform an install or uninstall of an application(s). 
    The script either performs an "Install" deployment type or an "Uninstall" deployment type.
    The install deployment type is broken down in to 3 main sections/phases: Pre-Install, Install, and Post-Install.
    The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
    To access the help section,
.EXAMPLE
    Deploy-Application.ps1
.EXAMPLE
    Deploy-Application.ps1 -DeploymentType "Silent"
.EXAMPLE
    Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
.EXAMPLE
    Deploy-Application.ps1 -Uninstall 
.PARAMETER DeploymentType
    The type of deployment to perform. [Default is "Install"]
.PARAMETER DeployMode
    Specifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
    Interactive = Default mode
    Silent = No dialogs
    NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
.PARAMETER AllowRebootPassThru
    Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. 
    If 3010 is passed back to SCCM a reboot prompt will be triggered.
.NOTES
.LINK 
    Http://psappdeploytoolkit.codeplex.com
"#>
Param (
    [ValidateSet("Install","Uninstall")] 
    [string] $DeploymentType = "Install",
    [ValidateSet("Interactive","Silent","NonInteractive")]
    [string] $DeployMode = "Interactive",
    [switch] $AllowRebootPassThru = $false
)

#*===============================================
#* VARIABLE DECLARATION
Try {
#*===============================================

#*===============================================
# Variables: Application

$appVendor = "Adobe"
$appName = "Flash Player"
$appVersion = "11.9.900.152"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.1"
$appScriptDate = "11/18/2013"
$appScriptAuthor = "Joseph Noxon"

#*===============================================
# Variables: Script - Do not modify this section

$deployAppScriptFriendlyName = "Deploy Application"
$deployAppScriptVersion = "3.0.7"
$deployAppScriptDate = "10/24/2013"
$deployAppScriptParameters = $psBoundParameters

# Variables: Environment
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition
# Dot source the App Deploy Toolkit Functions
."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"

#*===============================================
#* END VARIABLE DECLARATION
#*===============================================

#*===============================================
#* PRE-INSTALLATION
If ($deploymentType -ne "uninstall") { $installPhase = "Pre-Installation"
#*===============================================

    # Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install and persist the prompt
    Show-InstallationWelcome -CloseApps "iexplore,firefox"
    # -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt

    # Show Progress Message (with the default message)
    Show-InstallationProgress

    # Perform pre-installation tasks here
    # Uninstall Previous versions of Adobe Flash Player
    Remove-MSIApplications "Adobe Flash Player"
    

    
#*===============================================
#* INSTALLATION 
$installPhase = "Installation"
#*===============================================

    # Get the Internet Explorer version
    $ieVersion = Get-Item "HKLM:Software\Microsoft\Internet Explorer" -ErrorAction SilentlyContinue | Get-ItemProperty | Select "svcVersion" -ExpandProperty "svcVersion"
    $ieSubstringPos = $ieVersion.IndexOf(".")
    [int]$ieShortVersion = $ieVersion.Substring(0, $ieSubstringPos)

    # Install Flash Player ActiveX Control for IE versions prior to IE10 
    If ($ieShortVersion -lt 10) { 
        Execute-MSI -Action Install -Path "install_flash_player_11_active_x.msi"
    }
    # Install Flash Player Plugin (Firefox / Adobe Reader)
    Execute-MSI -Action Install -Path "install_flash_player_11_plugin.msi"

    # Set Adobe Flash Config file to stop Auto-Updates (32-bit)
    Copy-File -Path "$dirSupportFiles\mms.cfg" -Destination "$envWindir\system32\Macromed\Flash\mms.cfg"
    # Set Adobe Flash Config file to stop Auto-Updates (64-bit)
    Copy-File -Path "$dirSupportFiles\mms.cfg" -Destination "$envWindir\SysWOW64\Macromed\Flash\mms.cfg"

#*===============================================
#* POST-INSTALLATION
$installPhase = "Post-Installation"
#*===============================================

    # Perform post-installation tasks here

    # Display a message at the end of the install
    # Show-InstallationPrompt -Message "You can customise text to appear at the end of an install, or remove it completely for unattended installations." -ButtonRightText "Ok" -Icon Information -NoWait
 
#*===============================================
#* UNINSTALLATION
} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
#*===============================================

    # Show Welcome Message, close Internet Explorer if required with a 60 second countdown before automatically closing
    Show-InstallationWelcome -CloseApps "iexplore,firefox" 
    # -CloseAppsCountdown "60"

    # Show Progress Message (with the default message)
    Show-InstallationProgress

    # Perform uninstallation tasks here
    # Uninstall Flash Player Plug-in for Active-X (IE) Browsers
    Execute-MSI -Action Uninstall -Path "{EFC4BB62-CD01-4F63-9165-FC5DEB350469}"
    # Uninstall Flash Player Plug-in for Non-IE Browsers
    Execute-MSI -Action Uninstall -Path "{91A605E2-0372-4198-B64D-FA4D7E9FC851}"



#*===============================================
#* END SCRIPT BODY
} } Catch {$exceptionMessage = "$($_.Exception.Message) `($($_.ScriptStackTrace)`)"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1} # Catch any errors in this script 
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations
#*===============================================
Contents of MMS.cfg File:
SilentAutoUpdateEnable=0
AutoUpdateDisable=1
Coordinator
Nov 21, 2013 at 4:17 PM
Hey,

Great work on posting these. I have one suggestion as a replacement for the Installation section. The Flash ActiveX MSI will fail to install if IE version is 10 or higher. This check should work:
    # Get the Internet Explorer version
    $ieVersion = Get-Item "HKLM:Software\Microsoft\Internet Explorer" -ErrorAction SilentlyContinue | Get-ItemProperty | Select "svcVersion" -ExpandProperty "svcVersion"
    $ieSubstringPos = $ieVersion.IndexOf(".")
    [int]$ieShortVersion = $ieVersion.Substring(0, $ieSubstringPos)

    # Install Flash Player ActiveX Control for IE versions prior to IE10 
    If ($ieShortVersion -lt 10) { 
        Execute-MSI -Action Install -Path "install_flash_player_11_active_x.msi"
    }
    # Install Flash Player Plugin (Firefox / Adobe Reader)
    Execute-MSI -Action Install -Path "install_flash_player_11_plugin.msi"
Also, Chrome has Flash built in so doesn't need to be shut down prior to install (doesn't get touched by these MSIs).

Cheers, Dan
Nov 21, 2013 at 5:08 PM
Hey thanks for that Dan! That was extremely helpful. Like I said i am very new to Powershell or even vbscript for that matter. I have been using batch files for quite some time but am trying to expand my knowledge.

Thanks again,

Joe
Nov 28, 2013 at 9:34 AM
the please compile the script WITH the changes you made from sintaxasn's script.. so the script in the 1st post is the working one .. easier for people wanting to use it.
Dec 2, 2013 at 2:42 PM
Thx, done.
Coordinator
Dec 20, 2013 at 2:39 PM
I made a bit of an error here. As it turns out, this only applies to Windows 8 and above. Can you change the check as follows?
    # Get the OS version
    $osVersion = [version]$($envOS.version)

    # Install Flash Player ActiveX Control for IE (for OSes prior to Windows 8)
    If ($osVersion -lt 6.2) {
        Execute-MSI -Action Install -Path "install_flash_player_11_active_x.msi"
    }
Thanks, Dan
Feb 21, 2014 at 5:06 PM
Edited Feb 25, 2014 at 9:58 PM
Thank you for putting this script together! We deployed flash using this script, it worked well except if the computer had IE8 then it failed. The value "svcVersion" was not present on PC's with IE8 installed in the registry (9 and 10 were fine) so a null value was being logged and stopping the script.

Thanks,

Tony
Coordinator
Feb 25, 2014 at 7:02 PM
Apone007 wrote:
Thank you for putting this script together! We deployed flash using this script, it worked well except if the computer had IE8 then it failed. The value "svcVersion" was not present on a PC in the registry with IE8 (9 and 10 were fine) so a null value was being logged and stopping the script.

Thanks,

Tony
Hi Tony,

See my comments above. Replace the svcVersion check with osVersion. The Flash ActiveX should only be applied to machines running Windows 7 and lower.

Cheers, Dan
May 6, 2014 at 1:05 PM
JNoxon wrote:
# Set Adobe Flash Config file to stop Auto-Updates (32-bit)
Copy-File -Path "$dirSupportFiles\mms.cfg" -Destination "$envWindir\system32\Macromed\Flash\mms.cfg"
# Set Adobe Flash Config file to stop Auto-Updates (64-bit)
Copy-File -Path "$dirSupportFiles\mms.cfg" -Destination "$envWindir\SysWOW64\Macromed\Flash\mms.cfg"

Hi,

what is the behavior of "copy-file"?
You do not need to test if the path exists before? It will not create a tree SysWOW64 on 32-bit systems?
May 6, 2014 at 1:22 PM
another little thing

you should test OS version before the show-welcome

on W8 and superior, you will ask the user to close Internet Explorer whereas it's not necessary.
May 6, 2014 at 1:48 PM
Edited May 6, 2014 at 1:50 PM
and last question I think :D

what detection method do you configure ? As the activex MSI isn't installed on all computer ? only detect the plugin version ?
Jul 11, 2014 at 3:48 AM
Edited Jul 11, 2014 at 3:52 AM
sintaxasn wrote:
Hey,

Great work on posting these. I have one suggestion as a replacement for the Installation section. The Flash ActiveX MSI will fail to install if IE version is 10 or higher. This check should work:
    # Get the Internet Explorer version
    $ieVersion = Get-Item "HKLM:Software\Microsoft\Internet Explorer" -ErrorAction SilentlyContinue | Get-ItemProperty | Select "svcVersion" -ExpandProperty "svcVersion"
    $ieSubstringPos = $ieVersion.IndexOf(".")
    [int]$ieShortVersion = $ieVersion.Substring(0, $ieSubstringPos)

    # Install Flash Player ActiveX Control for IE versions prior to IE10 
    If ($ieShortVersion -lt 10) { 
        Execute-MSI -Action Install -Path "install_flash_player_11_active_x.msi"
    }
    # Install Flash Player Plugin (Firefox / Adobe Reader)
    Execute-MSI -Action Install -Path "install_flash_player_11_plugin.msi"
Also, Chrome has Flash built in so doesn't need to be shut down prior to install (doesn't get touched by these MSIs).

Cheers, Dan
Would you please tell us / supply code on how to detect if Firefox is installed? I would like to only install the flash player plugin if FIrefox is found on the machine. Thank you!
Jul 15, 2014 at 4:54 AM
Edited Jul 15, 2014 at 10:57 PM
Hello

Since sintaxasn is very busy I am sure with more important things I thought I would try and resolve my own problem. In my environment we have a mix of Windows 7 and Windows 8 with various browsers and versions. I would like to deliver both Flash ActiveX and Plugin at once to as many as possible . I figured I would check if Firefox was installed and then only update the Flash Plugin on those machines. And Windows 8 / 8.1 does not allow Flash ActiveX updates outside of Windows Updates so I wanted to skip those machines. Below is what I have so far. It appears to work but I'm sure it could be improved. Any ideas would be appreciated. :)

*===============================================

* INSTALLATION

$installPhase = "Installation"

*===============================================

# Get the OS version
$osVersion = [version]$($envOS.version)

# Check If Firefox Is Installed
If(Get-InstalledApplication -Name "Mozilla Firefox" -eq $true) {
Show-InstallationProgress "Installing Flash Player 14 Plugin (14.0.0.145). Please wait..."
Execute-MSI -Action Install -Path "install_flash_player_14_plugin.msi"
}

# Check If OS Is Windows 8 or greater    
If ($osVersion -lt "6.2") {
Show-InstallationProgress "Installing Flash Player 14 ActiveX (14.0.0.145). Please wait..."
Execute-MSI -Action Install -Path "install_flash_player_14_active_x.msi"
}
It would be nice if there was a way to only prompt a close of Internet Explorer on Windows 7, Vista ( OS versions less than 6.2 ) when installing Flash ActiveX.

THANKS!
Dec 10, 2014 at 6:15 AM
Ws2000:

I used this to only close IE on Windows 7 and lower:
if ($osVersion -ge 6.2) { Show-InstallationWelcome -CloseApps "Firefox,Chrome" -CloseAppsCountdown 30 }
if ($osVersion -lt 6.2) { Show-InstallationWelcome -CloseApps "iexplore,Firefox,Chrome" -CloseAppsCountdown 30 }
There might be a cleaner way to write that logic, but it works for me.
Dec 10, 2014 at 2:12 PM
Edited Dec 10, 2014 at 2:14 PM
therealjoshuad wrote:
Ws2000:

I used this to only close IE on Windows 7 and lower:
if ($osVersion -ge 6.2) { Show-InstallationWelcome -CloseApps "Firefox,Chrome" -CloseAppsCountdown 30 }
if ($osVersion -lt 6.2) { Show-InstallationWelcome -CloseApps "iexplore,Firefox,Chrome" -CloseAppsCountdown 30 }
There might be a cleaner way to write that logic, but it works for me.
I will give it a try but it looks like a much, much better solution. Many Thanks!
Dec 14, 2014 at 11:30 PM
I tried this on the new version 3.5.0 and I get an error below. Works fine on 3.1.5. Any ideas
# Check If Firefox or Acrobat Is Installed
            If ((Get-InstalledApplication -Name "Mozilla Firefox" -eq $true) -Or (Get-InstalledApplication -Name "Adobe Acrobat" -eq $true)) {
            Show-InstallationProgress "Installing Flash Player 15 Plugin. Please wait..."
            Execute-MSI -Action Install -Path "install_flash_player_16_plugin.msi" -Parameters "/qn ALLUSERS=2"
            }
Error
Message : A parameter cannot be found that matches parameter name 'eq'
InnerException:

FullyQualifiedErrorId:
NamedParameterNotFound, Get-InstalledApplication
Dec 15, 2014 at 12:02 AM
ws2000 wrote:
I tried this on the new version 3.5.0 and I get an error below. Works fine on 3.1.5. Any ideas
# Check If Firefox or Acrobat Is Installed
            If ((Get-InstalledApplication -Name "Mozilla Firefox" -eq $true) -Or (Get-InstalledApplication -Name "Adobe Acrobat" -eq $true)) {
            Show-InstallationProgress "Installing Flash Player 15 Plugin. Please wait..."
            Execute-MSI -Action Install -Path "install_flash_player_16_plugin.msi" -Parameters "/qn ALLUSERS=2"
            }
Error
Message : A parameter cannot be found that matches parameter name 'eq'
InnerException:

FullyQualifiedErrorId:
NamedParameterNotFound, Get-InstalledApplication
In the if() remove -eq true. It's treating -eq as a parameter, not a comparison operator.

iirc, by default if the statement in the if() block returns null, it's the same as "eq false" And if it returns a result, then it's considered true, and will run the script block following the if().
Dec 15, 2014 at 8:37 PM
Thanks again therealjoshuad !!! That worked just as you said it would.