Citrix Receiver 4.3.100

This script will deploy Citrix Receiver and the HDX RealTime Media Engine plugin. It also uninstall previous version of Receiver using the Receiver Cleanup Utility.

You need admins rights to run this script. This script works under the system account but remains invisible for the logged in user. This seems to be a known issue with PoSHAppDeployToolkit and will most likely be fixed in the future.

I also created a script that works for non-admin users but it is more limited since SSO wont work, Cleanup utility won’t run and the HDX RealTime Media Engine plugin will not install.

Here’s what you need to get the script working:

-Admin rights
-A copy of ReceiverCleanupUtility.exe in the Files folder
-A copy of the last Citrix Receiver named Receiver-#Version.exe in the Files folder
-A copy of the last Citrix_HDX_RealTime_Media_Engine.msi in the Files folder

I added the script at computer shutdown in a GPO and it works like a charm. I intend to add

<# .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 into 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. .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. 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. .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. .PARAMETER TerminalServerMode Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers. .PARAMETER DisableLogging Disables logging to file for the script. Default is: $false. .EXAMPLE Deploy-Application.ps1 .EXAMPLE Deploy-Application.ps1 -DeployMode 'Silent' .EXAMPLE Deploy-Application.ps1 -AllowRebootPassThru -AllowDefer .EXAMPLE Deploy-Application.ps1 -DeploymentType Uninstall .NOTES Toolkit Exit Code Ranges: 60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1 69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1 70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1 .LINK http://psappdeploytoolkit.com #>

[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[ValidateSet(‘Install’,‘Uninstall’)]
[string]$DeploymentType = ‘Install’,
[Parameter(Mandatory=$false)]
[ValidateSet(‘Interactive’,‘Silent’,‘NonInteractive’)]
[string]$DeployMode = ‘Interactive’,
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false
)

Try {
## Set the script execution policy for this process
Try { Set-ExecutionPolicy -ExecutionPolicy ‘ByPass’ -Scope ‘Process’ -Force -ErrorAction ‘Stop’ } Catch {}

##*===============================================
##* VARIABLE DECLARATION
##*===============================================
## Variables: Application
[string]$appVendor = 'Citrix'
[string]$appName = 'Receiver'
[string]$appVersion = '14.3.100.10'
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.0'
[string]$appScriptDate = '09/30/2015'
[string]$appScriptAuthor = 'Jonathan Pitre'
[string]$appCloseApps = 'CDViewer,wfica32,AuthManSvr,concentr,cpviewer,redirector,ssonsvr,wfcrun32,ceip,Receiver,wfcwow64,SelfServicePlugin,SelfService,PseudoContainer,PseudoContainer2,WebHelper'
[string]$appInstallParameters = 'DONOTSTARTCC=1 /silent /includeSSON /ALLOWADDSTORE=A /ALLOWSAVEPWD=A /ALLOW_CLIENTHOSTEDAPPSURL=1'
[string]$appUninstallParameters = '/silent /uninstall /cleanup'
##*===============================================

##* Do not modify section below
#region DoNotModify

## Variables: Exit Code
[int32]$mainExitCode = 0

## Variables: Script
[string]$deployAppScriptFriendlyName = 'Deploy Application'
[version]$deployAppScriptVersion = [version]'3.6.7'
[string]$deployAppScriptDate = '09/30/2015'
[hashtable]$deployAppScriptParameters = $psBoundParameters

## Variables: Environment
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent

## Dot source the required App Deploy Toolkit Functions
Try {
	[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
	If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
	If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
}
Catch {
	If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
	Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: <code>n$($_.Exception.Message)</code>n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
	## Exit the script, returning the exit code to SCCM
	If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
}

#endregion
##* Do not modify section above
##*===============================================
##* END VARIABLE DECLARATION
##*===============================================
	
If ($deploymentType -ine 'Uninstall') {
	##*===============================================
	##* PRE-INSTALLATION
	##*===============================================
	[string]$installPhase = 'Pre-Installation'
	
    ## Determine if the application is already installed if so quit the script
    If ($Is64Bit -eq $True) { [string]$appInstalledVersion = Get-RegistryKey -Key 'HKLM:\SOFTWARE\Wow6432Node\Citrix\PluginPackages\XenAppSuite\ICA_Client' -Value 'Version' -ContinueOnError $True }
    Else { [string]$appInstalledVersion = Get-RegistryKey -Key 'HKLM:\SOFTWARE\Citrix\PluginPackages\XenAppSuite\ICA_Client' -Value 'Version' -ContinueOnError $True }
    
    If ($appInstalledVersion -ge $appVersion) {
        Write-Log -Message 'Latest Citrix Receiver is already installed. Script will now exit.' -Source $deployAppScriptFriendlyName
        Exit-Script -ExitCode 0
    }

    Show-InstallationProgress -StatusMessage 'Citrix Receiver will now be installed/updated. This may take some time. Please wait...'
    Start-Sleep -s 5            

	## Show Welcome Message, close apps if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
	Show-InstallationWelcome -CloseApps $appCloseApps -CheckDiskSpace -RequiredDiskSpace 100 -Silent
	
    ## Citrix Lync Optimization Pack must be uninstalled before updating Citrix Receiver - http://support.citrix.com/article/CTX200340
    Show-InstallationProgress -StatusMessage 'Removing Citrix Lync Optimization Pack. This may take some time. Please wait...'
    Remove-MSIApplications -Name 'Citrix HDX RealTime Media Engine'

	## Remove Previous Citrix Receiver Installations
	Show-InstallationProgress -StatusMessage 'Removing previous version of Citrix Receiver. This may take some time. Please wait...'
    Copy-File -Path "$dirFiles\ReceiverCleanupUtility.exe" -Destination $envTemp
    Start-Sleep -s 5
    Execute-Process -Path "$envTemp\ReceiverCleanupUtility.exe" -Parameters '/silent'
	
	##*===============================================
	##* INSTALLATION 
	##*===============================================
	[string]$installPhase = 'Installation'
	
    # Install Application
    Show-InstallationProgress -StatusMessage 'Installing Citrix Receiver. This may take some time. Please wait...'
    #Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-noexit -Command &amp; { Show-InstallationProgress -StatusMessage 'Installing Citrix Receiver. This may take some time. Please wait...' }" -RunLevel HighestAvailable -Wait -PassThru
    Execute-Process -Path "Receiver-$appVersion.exe" -Parameters $appInstallParameters
	
    ## Install Citrix Lync Optimization Pack
    Show-InstallationProgress -StatusMessage 'Installing Citrix Lync Optimization Pack. This may take some time. Please wait...'
    Execute-MSI -Action Install -Path 'Citrix_HDX_RealTime_Media_Engine.msi' -Parameters '/qn'

	##*===============================================
	##* POST-INSTALLATION
	##*===============================================
	[string]$installPhase = 'Post-Installation'
	
	## Suppress the Add Account Window in Citrix Receiver - http://support.citrix.com/article/CTX135438
    Set-RegistryKey -Key 'HKLM\SOFTWARE\Policies\Citrix' -Name 'EnableFTU' -Value 0 -Type DWord

  
    If ($Is64Bit -eq $True)
    {
        ## Prevent dialog boxes when resources are removed from the server - http://support.citrix.com/article/CTX140244 
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Wow6432Node\Citrix\Dazzle' -Name 'DontWarnOfRemovedResources' -Value 'true' -Type String
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Wow6432Node\Citrix\Dazzle' -Name 'SilentlyUninstallRemovedResources' -Value 'true' -Type String
        ## Allow adding HTTP store - http://support.citrix.com/article/CTX134341
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Wow6432Node\Citrix\AuthManager' -Name 'ConnectionSecurityMode' -Value 'Any' -Type String
    }
    Else
    {
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Citrix\Dazzle' -Name 'DontWarnOfRemovedResources' -Value 'true' -Type String
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Citrix\Dazzle' -Name 'SilentlyUninstallRemovedResources' -Value 'true' -Type String
        Set-RegistryKey -Key 'HKLM\SOFTWARE\Citrix\AuthManager' -Name 'ConnectionSecurityMode' -Value 'Any' -Type String
    }

    ## Cleanup temp files
    Remove-File -Path "$envTemp\ReceiverCleanupUtility.exe"
    Remove-File -Path "$envTemp\config.xml"

	# Prompt for a restart
	Show-InstallationRestartPrompt -Countdownseconds 5 -CountdownNoHideSeconds 5
    
}
ElseIf ($deploymentType -ieq 'Uninstall')
{
	##*===============================================
	##* PRE-UNINSTALLATION
	##*===============================================
	[string]$installPhase = 'Pre-Uninstallation'
	
	## Show Welcome Message, close apps with a 60 second countdown before automatically closing
	Show-InstallationWelcome -CloseApps $appCloseApps -Silent
	
	## Show Progress Message (with the default message)
	Show-InstallationProgress
	
	
	##*===============================================
	##* UNINSTALLATION
	##*===============================================
	[string]$installPhase = 'Uninstallation'
	
	## Uninstall application
    Remove-MSIApplications -Name 'Citrix HDX RealTime Media Engine'
    Execute-Process -Path "Receiver-$appVersion.exe" -Parameters $appUninstallParameters
	
	
	##*===============================================
	##* POST-UNINSTALLATION
	##*===============================================
	[string]$installPhase = 'Post-Uninstallation'
	
	
}

##*===============================================
##* END SCRIPT BODY
##*===============================================

## Call the Exit-Script function to perform final cleanup operations
Exit-Script -ExitCode $mainExitCode

}
Catch {
[int32]$mainExitCode = 60001
[string]$mainErrorMessage = “$(Resolve-Error)”
Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’
Exit-Script -ExitCode $mainExitCode
}

Nice script! I used this as a template in my attempt with the 4.4 client however had some trouble with the installation string specifying the store to point to just as an fyi. For some reason it didn’t seem to be able to properly handle the parameter string I used of:

[string]$appInstallParameters = 'DONOTSTARTCC=1 /silent /includeSSON STORE0="CitrixStore;https://yourdomain.whatever.corp/yyyyyy/yyyyyyyy/discovery;CitrixStore"'

Specifically, it took the install command just fine, but when the client came up after the install it was in a state whereby it didn’t have a store configured, and wouldn’t allow one to be entered, and didn’t prompt when opening the client. Sort of a configuration-less and un-configurable-state.

So in my testing so far I’ve not successfully done a silent install specifying the store… If anyone has figured this out let me know!

I usually push the store by GPO using the Citrix Receiver ADMX template. It works quite nicely in our environment.

If your pushing this package with SCCM just have allow users to interact with program and users will see your prompts if logged in.