Advertisement
AutomateMyStuff

PADT - Firefox 38.3.0 ESR

Oct 7th, 2015
747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. .SYNOPSIS
  3.     This script performs the installation or uninstallation of an application(s).
  4. .DESCRIPTION
  5.     The script is provided as a template to perform an install or uninstall of an application(s).
  6.     The script either performs an "Install" deployment type or an "Uninstall" deployment type.
  7.     The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
  8.     The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
  9. .PARAMETER DeploymentType
  10.     The type of deployment to perform. Default is: Install.
  11. .PARAMETER DeployMode
  12.     Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
  13. .PARAMETER AllowRebootPassThru
  14.     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.
  15. .PARAMETER TerminalServerMode
  16.     Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
  17. .PARAMETER DisableLogging
  18.     Disables logging to file for the script. Default is: $false.
  19. .EXAMPLE
  20.     Deploy-Application.ps1
  21. .EXAMPLE
  22.     Deploy-Application.ps1 -DeployMode 'Silent'
  23. .EXAMPLE
  24.     Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
  25. .EXAMPLE
  26.     Deploy-Application.ps1 -DeploymentType Uninstall
  27. .NOTES
  28.     Toolkit Exit Code Ranges:
  29.     60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
  30.     69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1
  31.     70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
  32. .LINK
  33.     http://psappdeploytoolkit.com
  34. #>
  35. [CmdletBinding()]
  36. Param (
  37.     [Parameter(Mandatory=$false)]
  38.     [ValidateSet('Install','Uninstall')]
  39.     [string]$DeploymentType = 'Install',
  40.     [Parameter(Mandatory=$false)]
  41.     [ValidateSet('Interactive','Silent','NonInteractive')]
  42.     [string]$DeployMode = 'Interactive',
  43.     [Parameter(Mandatory=$false)]
  44.     [switch]$AllowRebootPassThru = $false,
  45.     [Parameter(Mandatory=$false)]
  46.     [switch]$TerminalServerMode = $false,
  47.     [Parameter(Mandatory=$false)]
  48.     [switch]$DisableLogging = $false
  49. )
  50.  
  51. Try {
  52.     ## Set the script execution policy for this process
  53.     Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}
  54.    
  55.     ##*===============================================
  56.     ##* VARIABLE DECLARATION
  57.     ##*===============================================
  58.     ## Variables: Application
  59.     [string]$appVendor = 'Mozilla'
  60.     [string]$appName = 'Firefox'
  61.     [string]$appVersion = '38.3.0 ESR'
  62.     [string]$appArch = ''
  63.     [string]$appLang = 'EN'
  64.     [string]$appRevision = '01'
  65.     [string]$appScriptVersion = '1.0.0'
  66.     [string]$appScriptDate = '10/07/2015'
  67.     [string]$appScriptAuthor = 'Chris Thomas'
  68.     ##*===============================================
  69.    
  70.     ##* Do not modify section below
  71.     #region DoNotModify
  72.    
  73.     ## Variables: Exit Code
  74.     [int32]$mainExitCode = 0
  75.    
  76.     ## Variables: Script
  77.     [string]$deployAppScriptFriendlyName = 'Deploy Application'
  78.     [version]$deployAppScriptVersion = [version]'3.6.5'
  79.     [string]$deployAppScriptDate = '08/17/2015'
  80.     [hashtable]$deployAppScriptParameters = $psBoundParameters
  81.    
  82.     ## Variables: Environment
  83.     If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
  84.     [string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent
  85.    
  86.     ## Dot source the required App Deploy Toolkit Functions
  87.     Try {
  88.         [string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
  89.         If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
  90.         If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
  91.     }
  92.     Catch {
  93.         If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
  94.         Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
  95.         ## Exit the script, returning the exit code to SCCM
  96.         If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
  97.     }
  98.    
  99.     #endregion
  100.     ##* Do not modify section above
  101.     ##*===============================================
  102.     ##* END VARIABLE DECLARATION
  103.     ##*===============================================
  104.        
  105.     If ($deploymentType -ine 'Uninstall') {
  106.         ##*===============================================
  107.         ##* PRE-INSTALLATION
  108.         ##*===============================================
  109.         [string]$installPhase = 'Pre-Installation'
  110.        
  111.         ## 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
  112.         Show-InstallationWelcome -CloseApps 'firefox' -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
  113.        
  114.         ## Show Progress Message (with the default message)
  115.         Show-InstallationProgress
  116.        
  117.         ## <Perform Pre-Installation tasks here>
  118.        
  119.        
  120.         ##*===============================================
  121.         ##* INSTALLATION
  122.         ##*===============================================
  123.         [string]$installPhase = 'Installation'
  124.        
  125.         ## Handle Zero-Config MSI Installations
  126.         If ($useDefaultMsi) {
  127.             [hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
  128.             Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
  129.         }
  130.        
  131.         ## <Perform Installation tasks here>
  132.           Execute-Process -Path "$dirFiles\Firefox Setup 38.3.0esr.exe" -Parameters "/INI=$dirFiles\config.ini"
  133.  
  134.        
  135.         ##*===============================================
  136.         ##* POST-INSTALLATION
  137.         ##*===============================================
  138.         [string]$installPhase = 'Post-Installation'
  139.        
  140.         ## <Perform Post-Installation tasks here>
  141.         #Execute-Process -Path "$envProgramFilesX86\Mozilla Maintenance Service\uninstall.exe" -Parameters "/S"
  142.         Copy-File -Path $dirFiles\cck2\defaults\pref\autoconfig.js -Destination "$envProgramFilesX86\Mozilla Firefox\defaults\pref"
  143.         Copy-File -Path $dirFiles\override.ini -Destination "$envProgramFilesX86\Mozilla Firefox\browser"
  144.  
  145.         #Copy The CCK2 Stuff
  146.         Copy-File -Path $dirFiles\cck2\cck2.cfg -Destination "$envProgramFilesX86\Mozilla Firefox"
  147.         New-Folder -Path "$envProgramFilesX86\Mozilla Firefox\cck2\"
  148.         Copy-File -Path $dirFiles\cck2\cck2\*.* -Destination "$envProgramFilesX86\Mozilla Firefox\cck2\"
  149.         New-Folder -Path "$envProgramFilesX86\Mozilla Firefox\cck2\modules\"
  150.         Copy-File -Path $dirFiles\cck2\cck2\modules\*.* -Destination "$envProgramFilesX86\Mozilla Firefox\cck2\modules\"
  151.  
  152.        
  153.         ## Display a message at the end of the install
  154.         If (-not $useDefaultMsi) {
  155.             If ($DeployMode -ne "Silent") {
  156.                 # Inform the user that the installation has completed
  157.                 Show-InstallationPrompt -Message "$installTitle has completed installation. `n `n If you encounter any issues with this software please call Help Desk at x1215." -Icon "Information" -ButtonMiddleText "OK" -NoWait
  158.             }
  159.         }
  160.     }
  161.     ElseIf ($deploymentType -ieq 'Uninstall')
  162.     {
  163.         ##*===============================================
  164.         ##* PRE-UNINSTALLATION
  165.         ##*===============================================
  166.         [string]$installPhase = 'Pre-Uninstallation'
  167.        
  168.         ## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
  169.         Show-InstallationWelcome -CloseApps 'firefox' -CloseAppsCountdown 60
  170.        
  171.         ## Show Progress Message (with the default message)
  172.         Show-InstallationProgress
  173.        
  174.         ## <Perform Pre-Uninstallation tasks here>
  175.        
  176.        
  177.         ##*===============================================
  178.         ##* UNINSTALLATION
  179.         ##*===============================================
  180.         [string]$installPhase = 'Uninstallation'
  181.        
  182.         ## Handle Zero-Config MSI Uninstallations
  183.         If ($useDefaultMsi) {
  184.             [hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
  185.             Execute-MSI @ExecuteDefaultMSISplat
  186.         }
  187.        
  188.         # <Perform Uninstallation tasks here>
  189.         Execute-Process -Path "$envProgramFilesX86\Mozilla Firefox\uninstall\helper.exe" -Parameters '/S'
  190.         Get-ChildItem -Path "$envProgramFilesX86\Mozilla Firefox" -Include * | Remove-Item -Recurse
  191.        
  192.        
  193.         ##*===============================================
  194.         ##* POST-UNINSTALLATION
  195.         ##*===============================================
  196.         [string]$installPhase = 'Post-Uninstallation'
  197.        
  198.         ## <Perform Post-Uninstallation tasks here>
  199.        
  200.        
  201.     }
  202.    
  203.     ##*===============================================
  204.     ##* END SCRIPT BODY
  205.     ##*===============================================
  206.    
  207.     ## Call the Exit-Script function to perform final cleanup operations
  208.     Exit-Script -ExitCode $mainExitCode
  209. }
  210. Catch {
  211.     [int32]$mainExitCode = 60001
  212.     [string]$mainErrorMessage = "$(Resolve-Error)"
  213.     Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
  214.     Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
  215.     Exit-Script -ExitCode $mainExitCode
  216. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement