Advertisement
chthomas

iTunes 11.3.0.54

Jul 23rd, 2014
388
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 in to 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.     To access the help section,
  10. .EXAMPLE
  11.     Deploy-Application.ps1
  12. .EXAMPLE
  13.     Deploy-Application.ps1 -DeploymentMode "Silent"
  14. .EXAMPLE
  15.     Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer
  16. .EXAMPLE
  17.     Deploy-Application.ps1 -Uninstall
  18. .PARAMETER DeploymentType
  19.     The type of deployment to perform. [Default is "Install"]
  20. .PARAMETER DeployMode
  21.     Specifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
  22.     Interactive = Default mode
  23.     Silent = No dialogs
  24.     NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
  25. .PARAMETER AllowRebootPassThru
  26.     Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation.
  27.     If 3010 is passed back to SCCM a reboot prompt will be triggered.
  28. .PARAMETER TerminalServerMode
  29.     Changes to user install mode and back to user execute mode for installing/uninstalling applications on Remote Destkop Session Host/Citrix servers
  30. .NOTES
  31. .LINK
  32.     Http://psappdeploytoolkit.codeplex.com
  33. "#>
  34. Param (
  35.     [ValidateSet("Install","Uninstall")]
  36.     [string] $DeploymentType = "Install",
  37.     [ValidateSet("Interactive","Silent","NonInteractive")]
  38.     [string] $DeployMode = "Interactive",
  39.     [switch] $AllowRebootPassThru = $false,
  40.     [switch] $TerminalServerMode = $false
  41. )
  42.  
  43. #*===============================================
  44. #* VARIABLE DECLARATION
  45. Try {
  46. #*===============================================
  47.  
  48. #*===============================================
  49. # Variables: Application
  50.  
  51. $appVendor = "Apple"
  52. $appName = "iTunes"
  53. $appVersion = "11.3.0.54"
  54. $appArch = ""
  55. $appLang = "EN"
  56. $appRevision = "01"
  57. $appScriptVersion = "1.0.0"
  58. $appScriptDate = "07/16/2014"
  59. $appScriptAuthor = "Chris Thomas"
  60.  
  61. #*===============================================
  62. # Variables: Script - Do not modify this section
  63.  
  64. $deployAppScriptFriendlyName = "Deploy Application"
  65. $deployAppScriptVersion = [version]"3.1.4"
  66. $deployAppScriptDate = "06/10/2014"
  67. $deployAppScriptParameters = $psBoundParameters
  68.  
  69. # Variables: Environment
  70. $scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition
  71. # Dot source the App Deploy Toolkit Functions
  72. ."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
  73.  
  74. #*===============================================
  75. #* END VARIABLE DECLARATION
  76. #*===============================================
  77.  
  78. #*===============================================
  79. #* PRE-INSTALLATION
  80. If ($deploymentType -ne "uninstall") { $installPhase = "Pre-Installation"
  81. #*===============================================
  82.  
  83.     # Perform pre-installation tasks here
  84.  
  85.     # Prompt the user to close the following applications if they are running:
  86.     Show-InstallationWelcome -CloseApps "iTunes,iTunesHelper,iPodService,AppleMobileDeviceHelper,AppleMobileDeviceService,BtTunesPlugIn" -AllowDefer -DeferTimes 3
  87.     # Show Progress Message (with the default message)
  88.     Show-InstallationProgress
  89.  
  90.     # Remove any previous versions of iTunes and the pre-requisites
  91.     Remove-MSIApplications "Apple Application Support"
  92.     Remove-MSIApplications "Apple Mobile Device Support"
  93.     Remove-MSIApplications "Apple Software Update"
  94.     Remove-MSIApplications "Bonjour"
  95.     Remove-MSIApplications "iTunes"
  96.  
  97. #*===============================================
  98. #* INSTALLATION
  99. $installPhase = "Installation"
  100. #*===============================================
  101.  
  102.     # Perform installation tasks here
  103.    
  104.     # Install the pre-requisites
  105.     Execute-MSI -Action Install -Path "$dirFiles\AppleApplicationSupport.msi"
  106.     Execute-MSI -Action Install -Path "$dirFiles\AppleMobileDeviceSupport64.msi"
  107.     Execute-MSI -Action Install -Path "$dirFiles\AppleSoftwareUpdate.msi"
  108.     Execute-MSI -Action Install -Path "$dirFiles\Bonjour64.msi"
  109.     Execute-MSI -Action Install -Path "$dirFiles\iTunes64.msi" -Parameters "DESKTOP_SHORTCUTS=0 /QN /NORESTART"
  110.  
  111. #*===============================================
  112. #* POST-INSTALLATION
  113. $installPhase = "Post-Installation"
  114. #*===============================================
  115.  
  116.     # Perform post-installation tasks here
  117.    
  118.     Remove-RegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "iTunesHelper"
  119.  
  120.     If ($DeployMode -ne "Silent") {
  121.         # Inform the user that the installation has completed
  122.         Show-InstallationPrompt -Message "$installTitle has completed installation. `n `n If you encounter any issues with this software please enter a ticket or call Help Desk at x4357." -Icon "Information" -ButtonMiddleText "OK" -NoWait
  123.     }
  124. #*===============================================
  125. #* UNINSTALLATION
  126. } ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
  127. #*===============================================
  128.  
  129.     # Perform uninstallation tasks here
  130.  
  131.     # Prompt the user to close the following applications if they are running:
  132.     Show-InstallationWelcome -CloseApps "iTunes,iTunesHelper,iPodService,AppleMobileDeviceHelper,AppleMobileDeviceService,BtTunesPlugIn" -AllowDefer -DeferTimes 3
  133.     # Show Progress Message (with a message to indicate the application is being uninstalled)
  134.     Show-InstallationProgress -StatusMessage "Uninstalling Application $installTitle. Please Wait..."
  135.  
  136.     Execute-MSI -Action Uninstall -Path "{21ECABC3-40B2-42DF-8E21-ACF3A4D0D95A}"
  137.     Execute-MSI -Action Uninstall -Path "{6AF2AC2A-3532-43FD-9F4D-BDC9C0D724C7}"
  138.     Execute-MSI -Action Uninstall -Path "{789A5B64-9DD9-4BA5-915A-F0FC0A1B7BFE}"
  139.     Execute-MSI -Action Uninstall -Path "{6E3610B2-430D-4EB0-81E3-2B57E8B9DE8D}"
  140.     Execute-MSI -Action Uninstall -Path "{33E28B58-7BA0-47B7-AA01-9225ABA2B8A9}"
  141.  
  142. #*===============================================
  143. #* END SCRIPT BODY
  144. } } Catch { $exceptionMessage = "$($_.Exception.Message) `($($_.ScriptStackTrace)`)"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1 } # Catch any errors in this script
  145. Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations
  146. #*===============================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement