This project is read-only.

Deployment Script: Citrix Receiver 14.1.0.0 (4.1)

Topics: Archive - Deployment Scripts
Nov 22, 2013 at 9:01 PM
OK. I think I finally have things worked out as thoroughly as I can.
  • Uninstalls previous versions of Citrix that I had access to. (Citrix Receiver, Citrix Receiver Enterprise, Citrix Online Plug-in, CitrixAGP)
  • Script closes the following processes: iexplore, ssonsvr, selfserviceplugin, receiver
  • Installs Citrix Receiver (default installation)
  • Removes registry keys that would start Citrix services after restart
  • Installs registry keys that prevent Citrix from updating in HKLM
  • Installs registry keys that prevent Citrix from updating in HKCU
  • Installs cmd file for Active setup.
  • Installs keys for the Active Setup to prevent Citris updating on a per user basis
  • Uninstalls silently based on the information in the uninstall key with an added /silent command
<#
.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 = "Citrix"
$appName = "Citrix Receiver"
$appVersion = "14.1.0.0"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.1"
$appScriptDate = "11/20/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"
#*===============================================

    # Close open service based on Citrix Article CTX137494 (http://support.citrix.com/article/CTX137494)
    Show-InstallationWelcome -CloseApps "iexplore,ssonsvr,selfserviceplugin,receiver" -Silent

    # Show Progress Message (with the default message)
    Show-InstallationProgress
    
    # Remove Previous Citrix Receiver Installations
    $strAllUsersProfile=(get-content env:ALLUSERSPROFILE)
    $strExistingInstall="$strAllUsersProfile\Citrix\Citrix Receiver\TrolleyExpress.exe"
    If ((Test-Path $strExistingInstall) -eq $true) {
        Execute-Process -FilePath "$strExistingInstall" -Arguments "/uninstall /cleanup /Silent"
        }
    # Remove Previous Citrix Receiver Enterprise Installations
    $strExistingInstall="$strAllUsersProfile\Citrix\Citrix Receiver (Enterprise)\TrolleyExpress.exe"
    If ((Test-Path $strExistingInstall) -eq $true) {
        Execute-Process -FilePath "$strExistingInstall" -Arguments "/uninstall /cleanup /Silent"
        }
    # Remove Previous Citrix online plug-in Installations
    $strExistingInstall="$strAllUsersProfile\Citrix\Citrix online plug-in\TrolleyExpress.exe"
    If ((Test-Path $strExistingInstall) -eq $true) {
        Execute-Process -FilePath "$strExistingInstall" -Arguments "/uninstall /cleanup /Silent"
        }
    # Remove any other MSI based installations of Citrix (i.e. Citrix AGP)
    Remove-MSIApplications "Citrix"
    
#*===============================================
#* INSTALLATION 
$installPhase = "Installation"
#*===============================================

    # Perform installation tasks here
    # Install Application
    Execute-Process -FilePath "CitrixReceiver.exe" -Arguments "/noreboot /silent"

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

    # Perform post-installation tasks here
    # Remove Registry Keys that start Citrix when Windows starts
    #64bit Keys
    If (([environment]::Is64BitOperatingSystem) -eq $true {
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "CitrixReceiver"
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "ConnectionCenter"
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "Redirector"
        }Else{
    #32bit Keys
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "CitrixReceiver"
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "ConnectionCenter"
    Remove-RegistryKey -Key "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "Redirector"
        }
    
    # Set Registry Keys to prevent Citrix Receiver from Updating
    Set-RegistryKey -Key "HKLM\SOFTWARE\Citrix\Receiver" -Name "AutoUpdatesEnabled" -Value 0 -Type DWord
    Set-RegistryKey -Key "HKLM\SOFTWARE\Citrix\Receiver" -Name "AutoUpdate" -Value 1 -Type DWord
    Set-RegistryKey -Key "HKLM\SOFTWARE\Citrix\Receiver" -Name "ShowIcon" -Value 0 -Type DWord

    # Create Active Setup to prevent AutoUpdate
    Copy-File -Path "$dirSupportFiles\CU-DisableCitrixUpdate.cmd" -Destination "$envWindir\Installer\CU-DisableCitrixUpdate.cmd"
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate" -Name "" -Value "DisableCitrixAutoUpdate" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate" -Name "ComponentID" -Value "DisableCitrixAutoUpdate" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate" -Name "Version" -Value "2013,11,20,1" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate" -Name "StubPath" -Value "$envWindir\Installer\CU-DisableCitrixUpdate.cmd" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate" -Name "Locale" -Value "EN" -Type String

    Set-RegistryKey -Key "HKCU\Software\Citrix\Receiver" -Name "AutoUpdatesEnabled" -Value 0 -Type DWord
    Set-RegistryKey -Key "HKCU\Software\Citrix\Receiver" -Name "AutoUpdate" -Value 1 -Type DWord
    Set-RegistryKey -Key "HKCU\Software\Citrix\Receiver" -Name "ShowIcon" -Value 0 -Type DWord
    
    # Close open service based on Citrix Article CTX137494 (http://support.citrix.com/article/CTX137494)
    Show-InstallationWelcome -CloseApps "iexplore,ssonsvr,selfserviceplugin,receiver" -Silent

    # Show-InstallationPrompt -Message "It is recommended that you restart your computer for the installation to finish completely." -ButtonRightText "Ok" -Icon Information -NoWait
 
#*===============================================
#* UNINSTALLATION
} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
#*===============================================

    # Close open service based on Citrix Article CTX137494 (http://support.citrix.com/article/CTX137494)
    Show-InstallationWelcome -CloseApps "iexplore,ssonsvr,selfserviceplugin,receiver" -Silent

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

    # Remove this version of Citrix Receiver
    Execute-Process -FilePath "CitrixReceiver.exe" -Arguments "/silent /uninstall"
    Remove-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\DisableCitrixAutoUpdate"
    Remove-File -Path "$envWindir\Installer\CU-DisableCitrixUpdate.cmd"
    
#*===============================================
#* 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 "CU-DisableCitrixUpdate.cmd"

REG ADD "HKCU\Software\Citrix\Receiver" /v AutoUpdatesEnabled /t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\Citrix\Receiver" /v AutoUpdate /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Citrix\Receiver" /v ShowIcon /t REG_DWORD /d 0 /f
Aug 8, 2014 at 12:12 PM
I would very much like to use your script but when I run it I get some errors:

At C:\Users\user\Desktop\14.1.0.0.ps1:122 char:48
  • If (([environment])::Is64BitOperatingSystem) -eq $true
  • ~
    Missing statement block after If ( condition ).
    At C:\Users\user\Desktop\14.1.0.0.ps1:157 char:2
  • } ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
  • ~
    The Try statement is missing its Catch or Finally block.
    At C:\Users\user\Desktop\14.1.0.0.ps1:157 char:44
  • } ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
  • ~
    Unexpected token '{' in expression or statement.
    At C:\Users\user\Desktop\14.1.0.0.ps1:173 char:3
  • } } Catch {$exceptionMessage = "$($_.Exception.Message) `($($_.ScriptStackTrace) ...
  • ~
    Unexpected token '}' in expression or statement.
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingStatementBlock
Could you help me please?
Aug 9, 2014 at 8:31 AM
Have you got the AppDeployToolkit file structure in place to support this script?
Oct 16, 2014 at 11:33 AM
Think it is a missing " ) " at the end of •If (([environment])::Is64BitOperatingSystem) -eq $true
I added it, and it works fine.
Oct 29, 2014 at 4:15 PM
Here is a detection method for version 14.1.200.13

$osarch = (gwmi win32_operatingsystem).osarchitecture
if ($osarch -eq "64-bit") {
$ReceiverVersion = (Get-ItemProperty -Path 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\CitrixOnlinePluginPackWeb' -ErrorAction SilentlyContinue).DisplayVersion
if ($ReceiverVersion -eq '14.1.200.13') {
    Write-Host 'Installed'
    }
} else {
$ReceiverVersion = (Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\CitrixOnlinePluginPackWeb' -ErrorAction SilentlyContinue).DisplayVersion
if ($ReceiverVersion -eq '14.1.200.13') {
    Write-Host 'Installed'
    }
}
Nov 5, 2014 at 1:47 AM
I keep getting an error on some clients of 1602. Uninstalls go fine but shortly after the install begins I get error code 1602. It seems it bugs out at the ICA portion of the install. Any ideas? Previous version that was installed was 13.4.0.25.