Deployment Script: Adobe Shockwave Player

Topics: Archive - Deployment Scripts
Nov 20, 2013 at 9:16 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.

Please feel free to make suggestions on how to make this better...
  • Closes down IE, Chrome, and Firefox
  • Uninstalls previous MSI installations of "Adobe Shockwave Player"
  • Installs Shockwave with MST applied
  • Uninstall string for this versions GUID
<#
.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 = "Shockwave Player"
$appVersion = "12.0.5.146"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$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,chrome,firefox" -CloseAppsCountdown "60"
    # -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt

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

    # Remove any previous versions of Adobe Reader
    Remove-MSIApplications "Adobe Shockwave Player"

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

     # Install the base MSI and apply a transform
     Execute-MSI -Action Install -Path "sw_lic_full_installer.msi" -Transform "sw_lic_full_installer_NOUPDATES.mst"

#*===============================================
#* 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,chrome,firefox" -CloseAppsCountdown "60"

    # Show Progress Message (with a message to indicate the application is being uninstalled)
    Show-InstallationProgress -StatusMessage "Uninstalling Application $installTitle. Please Wait..." 

    # Remove this version of Adobe Reader
    Execute-MSI -Action Uninstall -Path "{F7C86DD5-E38B-45FE-88E3-B0AAEA7123FF}"

#*===============================================
#* 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
#*===============================================
Notes on creating a No Updates MST file (thanks to the guys at ITNINJA):

Edit MSI in Orca, go to Transform menu --> New Transform

Table: Property
Property: ISCHECKFORPRODUCTUPDATES
Value: 0

Change value from y to n for all of the following keys.

Table: Registry
Key: SOFTWARE\Adobe\Shockwave 12\AutoUpdate
 SOFTWARE\Adobe\Shockwave 12\collectstats
 SOFTWARE\Adobe\Shockwave 12\uicontrol\CollectStatistics
 SOFTWARE\Adobe\Shockwave 12\uicontrol\DoMandatoryUpdates
 SOFTWARE\Adobe\Shockwave 12\uicontrol\OfferOptionalUpdates
 SOFTWARE\Adobe\Shockwave 12\uicontrol\defaultautoupdate
 SOFTWARE\Adobe\Shockwave 12\uicontrol\defaultcollectstats
 SOFTWARE\Macromedia\Shockwave 10\AutoUpdate
 SOFTWARE\Macromedia\Shockwave 10\CollectStatistics
 SOFTWARE\Macromedia\Shockwave 10\uicontrol\CollectStatistics
 SOFTWARE\Macromedia\Shockwave 10\uicontrol\DoMandatoryUpdates
 SOFTWARE\Macromedia\Shockwave 10\uicontrol\OfferOptionalUpdates
 SOFTWARE\Macromedia\Shockwave 10\uicontrol\defaultautoupdate
 SOFTWARE\Macromedia\Shockwave 10\uicontrol\defaultcollectstats
Value: n

Save Transform file (Transform menu --> Generate Transform)