brianfgonzalez

SAP PSADT

Apr 22nd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.54 KB | None | 0 0
  1. <#
  2. .SYNOPSIS
  3. This script performs the installation or uninstallation of an application(s).
  4. # LICENSE #
  5. PowerShell App Deployment Toolkit - Provides a set of functions to perform common application deployment tasks on Windows.
  6. Copyright (C) 2017 - Sean Lillis, Dan Cunningham, Muhammad Mashwani, Aman Motazedian.
  7. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  8. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  9. .DESCRIPTION
  10. The script is provided as a template to perform an install or uninstall of an application(s).
  11. The script either performs an "Install" deployment type or an "Uninstall" deployment type.
  12. The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
  13. The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
  14. .PARAMETER DeploymentType
  15. The type of deployment to perform. Default is: Install.
  16. .PARAMETER DeployMode
  17. 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.
  18. .PARAMETER AllowRebootPassThru
  19. 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.
  20. .PARAMETER TerminalServerMode
  21. Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
  22. .PARAMETER DisableLogging
  23. Disables logging to file for the script. Default is: $false.
  24. .EXAMPLE
  25. powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeployMode 'Silent'; Exit $LastExitCode }"
  26. .EXAMPLE
  27. powershell.exe -Command "& { & '.\Deploy-Application.ps1' -AllowRebootPassThru; Exit $LastExitCode }"
  28. .EXAMPLE
  29. powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeploymentType 'Uninstall'; Exit $LastExitCode }"
  30. .EXAMPLE
  31. Deploy-Application.exe -DeploymentType "Install" -DeployMode "Silent"
  32. .NOTES
  33. Toolkit Exit Code Ranges:
  34. 60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
  35. 69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1
  36. 70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
  37. .LINK
  38. http://psappdeploytoolkit.com
  39. #>
  40. [CmdletBinding()]
  41. Param (
  42. [Parameter(Mandatory=$false)]
  43. [ValidateSet('Install','Uninstall')]
  44. [string]$DeploymentType = 'Install',
  45. [Parameter(Mandatory=$false)]
  46. [ValidateSet('Interactive','Silent','NonInteractive')]
  47. [string]$DeployMode = 'Interactive',
  48. [Parameter(Mandatory=$false)]
  49. [switch]$AllowRebootPassThru = $false,
  50. [Parameter(Mandatory=$false)]
  51. [switch]$TerminalServerMode = $false,
  52. [Parameter(Mandatory=$false)]
  53. [switch]$DisableLogging = $false
  54. )
  55.  
  56. Try {
  57. ## Set the script execution policy for this process
  58. Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}
  59.  
  60. ##*===============================================
  61. ##* VARIABLE DECLARATION
  62. ##*===============================================
  63. ## Variables: Application
  64. [string]$appVendor = 'SAP'
  65. [string]$appName = 'Business Explorer'
  66. [string]$appVersion = '7.60'
  67. [string]$appArch = ''
  68. [string]$appLang = 'EN'
  69. [string]$appRevision = '01'
  70. [string]$appScriptVersion = '1.0.0'
  71. [string]$appScriptDate = '22/04/2020'
  72. [string]$appScriptAuthor = 'Brian Gonzalez'
  73. ##*===============================================
  74. ## Variables: Install Titles (Only set here to override defaults set by the toolkit)
  75. [string]$installName = ''
  76. [string]$installTitle = ''
  77.  
  78. ##* Do not modify section below
  79. #region DoNotModify
  80.  
  81. ## Variables: Exit Code
  82. [int32]$mainExitCode = 0
  83.  
  84. ## Variables: Script
  85. [string]$deployAppScriptFriendlyName = 'Deploy Application'
  86. [version]$deployAppScriptVersion = [version]'3.8.0'
  87. [string]$deployAppScriptDate = '23/09/2019'
  88. [hashtable]$deployAppScriptParameters = $psBoundParameters
  89.  
  90. ## Variables: Environment
  91. If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
  92. [string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent
  93.  
  94. ## Dot source the required App Deploy Toolkit Functions
  95. Try {
  96. [string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
  97. If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
  98. If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
  99. }
  100. Catch {
  101. If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
  102. Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
  103. ## Exit the script, returning the exit code to SCCM
  104. If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
  105. }
  106.  
  107. #endregion
  108. ##* Do not modify section above
  109. ##*===============================================
  110. ##* END VARIABLE DECLARATION
  111. ##*===============================================
  112.  
  113. If ($deploymentType -ine 'Uninstall') {
  114. ##*===============================================
  115. ##* PRE-INSTALLATION
  116. ##*===============================================
  117. [string]$installPhase = 'Pre-Installation'
  118.  
  119. ## 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
  120. Show-InstallationWelcome -CloseApps 'saplogon'
  121.  
  122. ## Show Progress Message (with the default message)
  123. Show-InstallationProgress
  124.  
  125. ## <Perform Pre-Installation tasks here>
  126.  
  127.  
  128. ##*===============================================
  129. ##* INSTALLATION
  130. ##*===============================================
  131. [string]$installPhase = 'Installation'
  132.  
  133. ## Handle Zero-Config MSI Installations
  134. If ($useDefaultMsi) {
  135. [hashtable]$ExecuteDefaultMSISplat = @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
  136. Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
  137. }
  138.  
  139. ## <Perform Installation tasks here>
  140. if (Test-Path "$envProgramFilesX86\SAP\FrontEnd\SAPgui\saplogon.exe")
  141. {
  142. # Check if installed version is an older version
  143. if ( (Get-ItemProperty "$envProgramFilesX86\SAP\FrontEnd\SAPgui\saplogon.exe").VersionInfo.FileVersion -lt 7600.1.5.1157 )
  144. {
  145. Show-InstallationProgress -StatusMessage 'Running update "AKEU_SAPGUI760CommonAndBI_20190715_1926.exe" (~15 mins)...'
  146. Execute-Process -Path "AKEU_SAPGUI760CommonAndBI_20190715_1926.exe" -Parameters '/Silent' -IgnoreExitCodes 129
  147. }
  148. } else {
  149. # Nothing is installed so run installer
  150. Show-InstallationProgress -StatusMessage 'Installing "AKEU_SAPGUI760CommonAndBI_20190715_1926.exe" (~15 mins)...'
  151. Execute-Process -Path "AKEU_SAPGUI760CommonAndBI_20190715_1926.exe" -Parameters '/Silent' -IgnoreExitCodes 129
  152. }
  153. # Run updates
  154. Show-InstallationProgress -StatusMessage 'Installing "gui760_05_1-80003144.exe" (~5 mins)...'
  155. Execute-Process -Path "gui760_05_1-80003144.exe" -Parameters '/Silent'
  156. Show-InstallationProgress -StatusMessage 'Installing "BIADDON760SP04_0-70004093.EXE" (~5 mins)...'
  157. Execute-Process -Path "BIADDON760SP04_0-70004093.EXE" -Parameters '/Silent'
  158.  
  159. Show-InstallationProgress -StatusMessage 'Applying registry customizations...'
  160. [scriptblock]$HKCURegistrySettings = {
  161.  
  162. # 01_regAppearance_good.reg
  163. Set-RegistryKey -Key 'HKCU\Software\SAP\General' -Name 'Language' -Value 'EN' -Type 'String' -SID $UserProfile.SID
  164. Set-RegistryKey -Key 'HKCU\Software\SAP\General' -Name 'OfficeMenuType' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  165.  
  166. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'SelectedTheme' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  167. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'Theme' -Value 'Tradeshow' -Type 'String' -SID $UserProfile.SID
  168. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'HuePaletteBuffer' -Value '9b9a8ffcfcedf4f3e3eae9d7e0dfd0d8d6c7cecdc0cbcbbdc1c0b2b7b6a8adac9fa09f958e8e847f7e7572726a6867605b5a544f4f493f3f3b65808e839daa8da8b795b1c1' -Type 'String' -SID $UserProfile.SID
  169. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'SignatureDefaultColor' -Value 'SAP Signature Default' -Type 'String' -SID $UserProfile.SID
  170. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'SignatureSystemDependentColorsActive' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  171. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'High Contrast Theme' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  172. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'ShowShadowBorder' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  173. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance' -Name 'CorbuIcon' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  174.  
  175. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Customer Colors\SAP Gold0' -Name 'Hue' -Value 30 -Type 'DWord' -SID $UserProfile.SID
  176. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Customer Colors\SAP Greeno' -Name 'Hue' -Value 128 -Type 'DWord' -SID $UserProfile.SID
  177. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Customer Colors\SAP Purple0' -Name 'Hue' -Value 268 -Type 'DWord' -SID $UserProfile.SID
  178.  
  179. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\D01' -Name 'ThemeName' -Value 'SAP Gold' -Type 'String' -SID $UserProfile.SID
  180. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EBD' -Name 'ThemeName' -Value 'SAP Gold0' -Type 'String' -SID $UserProfile.SID
  181. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EBP' -Name 'ThemeName' -Value 'SAP Greeno' -Type 'String' -SID $UserProfile.SID
  182. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EBQ' -Name 'ThemeName' -Value 'SAP Purple0' -Type 'String' -SID $UserProfile.SID
  183. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EED' -Name 'ThemeName' -Value 'SAP Gold' -Type 'String' -SID $UserProfile.SID
  184. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EEP' -Name 'ThemeName' -Value 'SAP Green' -Type 'String' -SID $UserProfile.SID
  185. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\EEQ' -Name 'ThemeName' -Value 'SAP Purple' -Type 'String' -SID $UserProfile.SID
  186. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\KA3' -Name 'ThemeName' -Value 'SAP Signature Default' -Type 'String' -SID $UserProfile.SID
  187. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\KAP' -Name 'ThemeName' -Value 'SAP Green' -Type 'String' -SID $UserProfile.SID
  188. Set-RegistryKey -Key 'HKCU\Software\SAP\General\Appearance\Systems\KAQ' -Name 'ThemeName' -Value 'SAP Purple' -Type 'String' -SID $UserProfile.SID
  189.  
  190. # 02_regLogonOptions.reg
  191. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'UseSAPLogonLanguageAsDefault' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  192. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'MessageServerTimeout' -Value 10 -Type 'DWord' -SID $UserProfile.SID
  193. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'ConfirmDelete' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  194. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'NoEditFunctionality' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  195. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'SapguiNTCmdOpts' -Value '' -Type 'String' -SID $UserProfile.SID
  196. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'HideToTrayBar' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  197. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'AllowCachingServerConfigFiles' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  198. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Options' -Name 'LandscapeCacheExpiryPeriod' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  199.  
  200. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings' -Name 'LastSelectedNodeType' -Value '1' -Type 'String' -SID $UserProfile.SID
  201. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings' -Name 'SplitterPosition' -Value '0' -Type 'String' -SID $UserProfile.SID
  202.  
  203. # 03_regLogonPadPositions.reg
  204. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth1' -Value '254' -Type 'String' -SID $UserProfile.SID
  205. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth2' -Value '55' -Type 'String' -SID $UserProfile.SID
  206. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth3' -Value '55' -Type 'String' -SID $UserProfile.SID
  207. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth4' -Value '200' -Type 'String' -SID $UserProfile.SID
  208. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth5' -Value '135' -Type 'String' -SID $UserProfile.SID
  209. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth6' -Value '134' -Type 'String' -SID $UserProfile.SID
  210. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnWidth7' -Value '150' -Type 'String' -SID $UserProfile.SID
  211. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder1' -Value 0 -Type 'Dword' -SID $UserProfile.SID
  212. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder2' -Value 2 -Type 'Dword' -SID $UserProfile.SID
  213. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder3' -Value 5 -Type 'Dword' -SID $UserProfile.SID
  214. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder4' -Value 4 -Type 'Dword' -SID $UserProfile.SID
  215. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder5' -Value 1 -Type 'Dword' -SID $UserProfile.SID
  216. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder6' -Value 3 -Type 'Dword' -SID $UserProfile.SID
  217. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'ColumnOrder7' -Value 6 -Type 'Dword' -SID $UserProfile.SID
  218. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'Left' -Value '50' -Type 'String' -SID $UserProfile.SID
  219. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'Top' -Value '50' -Type 'String' -SID $UserProfile.SID
  220. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'Right' -Value '624' -Type 'String' -SID $UserProfile.SID
  221. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPLogon\Settings\Connections' -Name 'Bottom' -Value '640' -Type 'String' -SID $UserProfile.SID
  222.  
  223. # 04_regCustomize.reg
  224. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Administration' -Name 'ShowAdditionalTitleInfo' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  225.  
  226. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'ShowCmdLine' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  227. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'Edit.InsertMode' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  228. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'StatusShowMode' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  229. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'Statusbar.Layout' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  230. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'QuickCP' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  231. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'BubbleDelay' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  232. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'BubbleOnTab' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  233. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'BeepError' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  234. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'PopupSuccess' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  235. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'PopupWarning' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  236. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'PopupError' -Value 0 -Type 'DWord' -SID $UserProfile.SID
  237. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'Edit.CaretWidth' -Value 2 -Type 'DWord' -SID $UserProfile.SID
  238. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Customize' -Name 'Edit.BlockCursor' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  239.  
  240. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'MaxCacheSize' -Value 10485760 -Type 'DWord' -SID $UserProfile.SID
  241. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'MaxCacheFileSize' -Value 2097152 -Type 'DWord' -SID $UserProfile.SID
  242. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'ShowMode' -Value 1 -Type 'DWord' -SID $UserProfile.SID
  243. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'Expiration' -Value 3 -Type 'DWord' -SID $UserProfile.SID
  244. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'FileSize' -Value 10 -Type 'DWord' -SID $UserProfile.SID
  245. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'NoEntries' -Value 999 -Type 'DWord' -SID $UserProfile.SID
  246. Set-RegistryKey -Key 'HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\LocalData' -Name 'FieldLenHistoryOn' -Value 59 -Type 'DWord' -SID $UserProfile.SID
  247. }
  248. Invoke-HKCURegistrySettingsForAllUsers -RegistrySettings $HKCURegistrySettings
  249. ##*===============================================
  250. ##* POST-INSTALLATION
  251. ##*===============================================
  252. [string]$installPhase = 'Post-Installation'
  253.  
  254. ## <Perform Post-Installation tasks here>
  255.  
  256. ## Display a message at the end of the install
  257. If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'SAP installation is complete.' -ButtonRightText 'OK' -Icon Information -NoWait }
  258. }
  259. ElseIf ($deploymentType -ieq 'Uninstall')
  260. {
  261. ##*===============================================
  262. ##* PRE-UNINSTALLATION
  263. ##*===============================================
  264. [string]$installPhase = 'Pre-Uninstallation'
  265.  
  266. ## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
  267. Show-InstallationWelcome -CloseApps 'iexplore' -CloseAppsCountdown 60
  268.  
  269. ## Show Progress Message (with the default message)
  270. Show-InstallationProgress
  271.  
  272. ## <Perform Pre-Uninstallation tasks here>
  273.  
  274.  
  275. ##*===============================================
  276. ##* UNINSTALLATION
  277. ##*===============================================
  278. [string]$installPhase = 'Uninstallation'
  279.  
  280. ## Handle Zero-Config MSI Uninstallations
  281. If ($useDefaultMsi) {
  282. [hashtable]$ExecuteDefaultMSISplat = @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
  283. Execute-MSI @ExecuteDefaultMSISplat
  284. }
  285.  
  286. # <Perform Uninstallation tasks here>
  287. Execute-Process -Path "$envProgramFilesX86\SAP\SAPsetup\setup\NwSapSetup.exe" -Arguments '/uninstall /product="PdfPrintGui+SCRIPTED+SCE+SAPDTS+KW+GUIISHMED+JNet+CALSYNC+SAPGUI" /TitleComponent:"SAPGUI" /IgnoreMissingProducts /silent'
  288.  
  289. ##*===============================================
  290. ##* POST-UNINSTALLATION
  291. ##*===============================================
  292. [string]$installPhase = 'Post-Uninstallation'
  293.  
  294. ## <Perform Post-Uninstallation tasks here>
  295.  
  296.  
  297. }
  298.  
  299. ##*===============================================
  300. ##* END SCRIPT BODY
  301. ##*===============================================
  302.  
  303. ## Call the Exit-Script function to perform final cleanup operations
  304. Exit-Script -ExitCode $mainExitCode
  305. }
  306. Catch {
  307. [int32]$mainExitCode = 60001
  308. [string]$mainErrorMessage = "$(Resolve-Error)"
  309. Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
  310. Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
  311. Exit-Script -ExitCode $mainExitCode
  312. }
Add Comment
Please, Sign In to add comment