Download And Install Citrix Receiver

Posted on
Download And Install Citrix Receiver 9,8/10 1701 votes

It is an optional download, provided on an as-is basis by Citrix to serve as an example. Before use, IT administrators must customize the scripts to suit their environment. The uninstall and install scripts may be used as noted in the upgrade guide for Citrix Receiver for Windows ( CTX135933 ). To successfully install the Citrix Receiver there are some tricks and tweaks needed. In this bog I will give a solution and a possible explanation. Unattended install. The first step is to find out if it is possible to install the Citrix Receiver in an unattended way.

  1. Download And Install Citrix
  2. Citrix Receiver Client

Citrix Receiver

admin

The description of Citrix Receiver

Using your Citrix virtualized applications and desktops is faster and easier than ever. Just ask your IT department how to get started.• Work on your favorite device from wherever you are• Access email or other corporate applications• Access your desktop from your phone, tablet, or all in one

Problems downloading or installing the app? See https://www.citrix.com/content/dam/citrix/en_us/documents/go/citrix-receiver-for-android.pdf

Still need help? Please tell us more about the issue. http://discussions.citrix.com/forum/1269-receiver-for-android

If your company doesn’t use Citrix yet, you can install Receiver and see what it's like by using the demo – http://citrixcloud.net

For more information about Citrix Receiver, visit http://citrix.com/receiver

Also check out GotoMeeting, GoToMyPC, Sharefile or other applications from Citrix.

How to play Citrix Receiver on PC

Download and Install Nox App Player Android Emulator. Click here to download: Download(FREE)

Run Nox App Player Android Emulator and login Google Play Store

Open Google Play Store and search Citrix Receiver Download

Install Citrix Receiver and start it

Well done! Now you can play Citrix Receiver on PC, just like Citrix Receiver for PC version.

Citrix Receiver unattended installation with PowerShell is a must in automated environments. Also, Citrix Receiver requires some additional configuration to make it run smoothly in your environment. This article explains and automates the most important ones.

Note: Citrix Receiver has been replaced by Citrix Workspace App. For detailed information how to install and configure Citrix Workspace App, see the article Citrix Workspace App unattended installation with PowerShell on this website.
Change Log
24.09.2018: added Prevent an unexpected MSI repair from launching.

Table of Contents

  • Installing and configuring Citrix Receiver

Introduction

The Citrix Receiver is a client component in a Citrix infrastructure that allows a user to launch Citrix XenApp and XenDesktop resources, such as published applications and desktops.

This article is based on Citrix Receiver 4.12 released in June 2018. This is the last version of Receiver. Receiver has been replaced by Citrix Workspace App.

Installing and configuring Citrix Receiver for Windows requires careful planning. You need to decide which components to enable, how to configure the default device access behavior, how to configure the Citrix Receiver group policies, whether of not to allow single sign-on and more.

For those of you who know my blog, Citrix Receiver is one of the components listed in my article Scripting the complete list of Citrix components with PowerShell, but I decided to create this stand-alone article to allow me to go into more detail.

I strongly suggest you to read the article Receiver / Workspace app 1808 written by Citrix CTP Carl Stalhood. This is the most detailed article on Receiver available.

Installing and configuring Citrix Receiver

Installing and configuring Citrix Receiver is not as straightforward as one might think. There are many details that can either make or break your deployment. Read and implement the sections below to ensure a smooth and successful deployment.

Summary

  • Target device:
    Receiver can be installed both on your virtual servers and desktops (alongside the VDA) as well as on the local client device. This all depends on your Citrix infrastructure and your access scenarios.
  • Installation file name:
    CitrixReceiver.exe (or, after renaming, CitrixReceiverWeb.exe)
  • Version (latest):
    4.12 (released in June 2018). This is the last version of Receiver. Receiver has been replaced by Citrix Workspace App.
  • Installation parameters (command-line switches):
    See the section Citrix Receiver command-line switches below.
  • Uninstallation parameters (command-line switches):
    The following two command line switches are required to uninstall Citrix Receiver: /silent /uninstall. The /noreboot parameter is not needed during a silent installation according to the Citrix documentation.
  • Installation dependencies:
    No
  • Other dependencies:
    No
  • Reboot required:
    Yes (for certain components such as Single Sign-on, /includeSSON)
  • ADMX files:
    Yes (see the section on Group Policies in the conclusion of this article)
  • Ports and firewall:
    No (outbound communication only, e.g. port 80, 443, 1494, 2598)
  • Download location:
    Receiver 4.12 for Windows
  • Reference:
    Configure and install Citrix Receiver for Windows using Command Line parameters

Citrix Receiver installation file (CitrixReceiver.exe)

The latest version of Citrix Receiver can be downloaded here. The download contains one file: CitrixReceiver.exe. This file contains a number of MSI files; one MSI installer per component. This is the list of components for Receiver 4.12:

  • AuthManager.msi
  • CitrixHDXMediaStreamForFlash-ClientInstall.msi
  • DesktopViewer.msi
  • GenericUSB.msi
  • ICAWebWrapper.msi
  • RIInstaller.msi
  • SelfServicePlugin.msi
  • SSONWrapper.msi
  • Vd3dClient.msi
  • WebHelper.msi
Note:
Use the following command to extract the individual MSI files from the CitrixReceiver.exe installation file: CitrixReceiver.exe /extract %directory%

For example:
C:CitrixReceiver.exe /extract C:TempReceiverExtracted

Make sure to create the destination directory beforehand.

Reference:How to Manually Extract, Install, and Remove Individual .msi Files from Receiver.exe or ReceiverEnterprise.exe.

The version is not displayed in the file name, so the file name is the same for each version of Receiver. To see the version of the executable, you have to take a look at the Details tab in the file properties.

The version displayed in the details tab is always a little bit different than the commercial version displayed on the official Citrix download page.

Example:

Version 4.12 of Citrix Receiver has the product version 14.12.0 and file version 14.12.0.17061. You basically should ignore the first '1' in the product version to get to the commercial version.

So why are different numbers used for the same version you may wonder? The exact reason is not known to me, but it most likely has something to with re-branding. You see, the first 4.x version of Receiver (which was not called Receiver at that time) was released in 1998. In June of 2013, version 4.x resurfaced. Don't believe me? Check out the official Citrix Receiver for Windows Quick Reference Version List listing all Receiver versions since September 1998. The list seems to miss some newer versions that came after version 4.9 though.

Another thing you should know about the installation file is that renaming it from CitrixReceiver.exe to CitrixReceiverWeb.exe changes the installation behavior. See the section Prevent the Add Account Window for more details.

Citrix Receiver command-line switches

There are various parameters you can parse. For a detailed overview of all parameters please refer to the article Configure and install Citrix Receiver for Windows using Command Line parameters. I strongly suggest to read the entire article before deploying Citrix Receiver.

You can also use the Citrix Receiver Commandline Helper Tool to help you to build the exact command line syntax.

It is difficult for me to tell you exactly which command line switches (= parameters) you should use. This all depends on your environment. However, you should be aware of the following:

  • Some parameters are required to work together with server-side components, such as enabling bidirectional content redirection.
  • Some parameters require local administrator rights, such as /includeSSON to enable single sign-on authentication.
  • In some cases a reboot may be required. For example, USB devices that are in suspended state when Citrix Receiver for Windows installs is not recognized by Citrix Receiver for Windows until after the user device is restarted (reference).

These are the parameters I use for most environments:

  • /silent
    All of my deployments are automated, including Citrix Receiver. I therefore need to use the /silent parameter.
  • /includeSSON
    This enables single sign-on (pass-through authentication) so a user does not need to enter authentication information for a second time after logging on to Windows.
  • /FORCE_LAA=1
    This enables Local App Access.
  • EnableCEIP=false
    Do not enable participation in the Citrix Customer Experience Improvement Program (CEIP). CEIP collects anonymous statistics and usage information and sends them to Citrix.
  • /AutoUpdateCheck = disabled
    I personally prefer to test new versions of Citrix Receiver before implementing them in production (so no automatic updates are allowed). You can also omit this parameter entirely and manage the auto-update behavior using Group Policy. See also the Auto-Update section in Carl Stalhood's article Receiver / Workspace app 1808.

The /noreboot parameter is not required for silent installations according to the Citrix documentation. If possible, I recommend rebooting the machine before using Citrix Receiver.

Citrix Receiver log files

The installation of Receiver generates multiple log files: one general log file ('Trolley Express') and one log file per MSI installation, for example:

  • TrolleyExpress-%Date%-%Time%.log
  • CtxInstall-CitrixHDXMediaStreamForFlash-ClientInstall-%Date%-%Time%.log
  • CtxInstall-DesktopViewer-%Date%-%Time%.log
  • CtxInstall-SelfServicePlugin-%Date%-%Time%.log

The total number of log files depends on the number of components you install. Each MSI log file represents one component; the more components you install, the more log files will be generated (up to a total of 10).

The installation log files generated by Citrix Receiver are always created in the TEMP folder. The location of the TEMP folder in most environments is one of the following:

  • C:Users%UserName%AppDataLocalTemp
    This directory is for sure used in many environments. Each user has its own temporary directory.
  • C:Users%UserName%AppDataLocalTemp%SessionNumber%
    This is almost the same directory as the previous one. The difference is that each user has its own temporary directory per session. If allowed by the administrator, a user can have multiple sessions on one system.
  • C:WindowsTemp
    This is the TEMP of the local SYSTEM account. Software deployment tools such as Microsoft SCCM use the SYSTEM account for installations on the local machine.
  • C:Temp
    This directory may be used on a FAT client. On a multi-user system it is not typical to use one temp directory for multiple users.

Of course the TEMP directory in your environment may be different than the ones listed above. The environment variable %TEMP% will always contain the correct location of the TEMP directory.

Unfortunately, there is no installation (or uninstallation) parameter that allows the log files to be written to another directory besides TEMP. There is no command-line switch like /Logfile or /Log.

The only way to capture the log files in a directory other then TEMP is to copy them from the TEMP folder after the installation has finished.

In the complete installation script below, the script starts by deleting any existing Citrix Receiver log files from the TEMP directory (lines 692 to 701). By using the environment variable %TEMP% the script makes sure that the correct TEMP directory is used.
After the installation (or uninstallation), the script copies the newly created log files to the log directory declared in the variable $LogDir. The log directory ($LogDir) is a combination of the variables $BaseLogDir and $PackageName. You can change these variables in lines 669 and 670.

Configure default device access behavior (Client Selective Trust)

As per Citrix: 'With the introduction of Receiver 3.x client, administrators can configure the default behavior for device access when connecting to a Citrix XenDesktop or XenApp environment. By default, the Desktop Viewer client device restrictions are based on the Internet region and this behavior can be changed by creating the Client Selective Trust feature registry keys under the HKEY_LOCAL_MACHINE hive in the registry and by modifying the required values.'

For example, when you allow the user to access files on the local client device, you may see the following security warning:

The security popup can concern the following local resources:

  • Client Drives
  • Microphones and Webcams
  • USB and other Devices

The default behavior of Receiver is to prompt the user. As an administrator, you can define the access level by modifying the registry or by using the ADMX group policy template. There are four access levels:

  • 0 = No Access
  • 1 = Read Only Access
  • 2 = Full Access
  • 3 = Prompt User for Access
Mac

Please see the Citrix article How to Configure Default Device Access Behavior of Receiver, XenDesktop and XenApp for more information.

I decided to modify the default behavior using the registry. I downloaded the ZIP file from the aforementioned article and modified the file ReceiverCSTRegUpx86.reg. I set all relevant registry entries to 2 (= Full Access) except for the Restricted Sites region/zone (these values remain on 0 = No Access).

Note: yes, I used the file ReceiverCSTRegUpx86.reg even though I installed Receiver on a 64-bit operating system. On a 64-bit operating system, Receiver still installs itself in the folder C:Program Files (x86) and all processes run in 32-bit.

You can download a copy of this modified file here:

CitrixReceiver Client Selective Trust x86 Dennisspan.com.zip

In the complete installation script below, the script imports the registry file in lines 752 to 756. Please make sure that you copy the actual file to the subdirectory Files. Also, in case you rename the registry file, please make sure to change the file name in the script as well (line 755).

Please be aware that pre-configuring the Client Selective Trust settings does NOT prevent a user from changing these settings! A user can configure his or her connection preferences in the Connection Center under Preferences.

In case you want to prevent the user from changing the preferences, set the value (Default) in the following registry key to false:

HKLMSOFTWAREWOW6432NodeCitrixICA ClientClient Selective TrustoidPredefinedSecurityPolicySettingsInstantiatedSecurityPolicyEditable

Like this:

As you can see in the screenshot below, after changing the (Default) value (REG_SZ) to false, the user is no longer able to change the preferences.

You do not even need to close the active session for this setting to work. You only have to close the Preferences window and open it again after changing the registry value. The change is active instantly.

The complete installation script below does NOT change the (Default) registry value. In case you would like to change it, please add the following code:

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
172
174
176
178
180
182
184
186
188
190
192
194
196
198
200
202
204
206
208
210
212
214
216
218
220
222
224
226
228
230
232
234
236
238
240
242
244
246
248
250
252
254
256
258
260
262
264
266
268
270
272
274
276
278
280
282
284
286
288
290
292
294
296
298
300
302
304
306
308
310
312
314
316
318
320
322
324
326
328
330
332
334
336
338
340
342
344
346
348
350
352
354
356
358
360
362
364
366
368
370
372
374
376
378
380
382
384
386
388
390
392
394
396
398
400
402
404
406
408
410
412
414
416
418
420
422
424
426
428
430
432
434
436
438
440
442
444
446
448
450
452
454
456
458
460
462
464
466
468
470
472
474
476
478
480
482
484
486
488
490
492
494
496
498
500
502
504
506
508
510
512
514
516
518
520
522
524
526
528
530
532
534
536
538
540
542
544
546
548
550
552
554
556
558
560
562
564
566
568
570
572
574
576
578
580
582
584
586
588
590
592
594
596
598
600
602
604
606
608
610
612
614
616
618
620
622
624
626
628
630
632
634
636
638
640
642
644
646
648
650
652
654
656
658
660
662
664
666
668
670
672
674
676
678
680
682
684
686
688
690
692
694
696
698
700
702
704
706
708
710
712
714
716
718
720
722
724
726
728
730
732
734
736
738
740
742
744
746
748
750
752
754
756
758
760
762
764
766
768
770
772
774
776
778
780
782
784
786
788
790
792
794
796
798
800
802
804
806
808
810
812
814
816
818
820
822
824
826
#
# CITRIX RECEIVER FOR WINDOWS
# AUTHOR: Dennis Span (https://dennisspan.com)
#
# COMMENT: This script installs and configured Citrix Receiver for Windows 4.12
# This script will also work with older 4.x versions of Receiver for Windows
# This script has been created for Windows 10 version 1709 and higher and Windows Server 2016 version 1607 and higher
# This script has been tested on Windows 10 version 1709
# Change log:
# 24.09.2018 Dennis Span: added registry value change to prevent unexpected MSI repairs from starting (lines 760 to 768)
#
# Get the script parameters if there are any
(
# The only parameter which is really required is 'Uninstall'
# If no parameters are present or if the parameter is not
# 'uninstall', an installation process is triggered
)
# define Error handling
$global:ErrorActionPreference='Stop'
if($verbose){$global:VerbosePreference='Continue'}
# FUNCTION DS_WriteLog
#
<#
Write text to this script's log file
Write text to this script's log file
This parameter contains the information type prefix. Possible prefixes and information types are:
S = Success
E = Error
.PARAMETER Text
This parameter contains the text (the line) you want to write to the log file. If text in the parameter is omitted, an empty line is written.
This parameter contains the full path, the file name and file extension to the log file (e.g. C:LogsMyAppsMylogFile.log)
DS_WriteLog -InformationType 'I' -Text 'Copy files to C:Temp' -LogFile 'C:LogsMylogFile.log'
Writes a line containing information to the log file
DS_WriteLog -InformationType 'E' -Text 'An error occurred trying to copy files to C:Temp (error: $($Error[0]))' -LogFile 'C:LogsMylogFile.log'
Writes a line containing error information to the log file
DS_WriteLog -InformationType '-' -Text ' -LogFile 'C:LogsMylogFile.log'
#>
Param(
[Parameter(Mandatory=$true,Position=0)][ValidateSet('I','S','W','E','-',IgnoreCase=$True)][String]$InformationType,
[Parameter(Mandatory=$true,Position=1)][AllowEmptyString()][String]$Text,
[Parameter(Mandatory=$true,Position=2)][AllowEmptyString()][String]$LogFile
}
process{
$DateTime=(Get-Date-formatdd-MM-yyyy)+' '+(Get-Date-formatHH:mm:ss)
if($Text-eq'){
Add-Content$LogFile-value(')# Write an empty line
Add-Content$LogFile-value($DateTime+' '+$InformationType.ToUpper()+' - '+$Text)
}
end{
}
#
# FUNCTION DS_InstallOrUninstallSoftware
#
<#
Install or uninstall software (MSI or SETUP.exe)
Install or uninstall software (MSI or SETUP.exe)
This parameter contains the file name including the path and file extension, for example C:TempMyAppFilesMyApp.msi or C:TempMyAppFilesMyApp.exe.
This parameter contains the installation type, which is either 'Install' or 'Uninstall'.
This parameter contains the command line arguments. The arguments list can remain empty.
In case of an MSI, the following parameters are automatically included in the function and do not have
to be specified in the 'Arguments' parameter: /i (or /x) /qn /norestart /l*v 'c:LogsMyLogFile.log'
DS_InstallOrUninstallSoftware -File 'C:TempMyAppFilesMyApp.msi' -InstallationType 'Install' -Arguments '
Installs the MSI package 'MyApp.msi' with no arguments (the function already includes the following default arguments: /i /qn /norestart /l*v $LogFile)
DS_InstallOrUninstallSoftware -File 'C:TempMyAppFilesMyApp.msi' -InstallationType 'Uninstall' -Arguments '
Uninstalls the MSI package 'MyApp.msi' (the function already includes the following default arguments: /x /qn /norestart /l*v $LogFile)
DS_InstallOrUninstallSoftware -File 'C:TempMyAppFilesMyApp.exe' -InstallationType 'Install' -Arguments '/silent /logfile:C:LogsMyApplog.log'
#>
Param(
[Parameter(Mandatory=$true,Position=0)][String]$File,
[Parameter(Mandatory=$true,Position=1)][AllowEmptyString()][String]$Installationtype,
[Parameter(Mandatory=$true,Position=2)][AllowEmptyString()][String]$Arguments
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
$FileName=($File.Split('))[-1]
$FileExt=$FileName.SubString(($FileName.Length)-3,3)
# Prepare variables
if($Installationtype-eq'Uninstall'){
$Result2='uninstallation'
$Result1='installed'
}
$LogFileAPP=Join-path$LogDir('$($Installationtype)_$($FileName.Substring(0,($FileName.Length)-4))_$($FileExt).log')
# Logging
DS_WriteLog'I''File full path: $File'$LogFile
# Check if the installation file exists
DS_WriteLog'E''The file '$File' does not exist!'$LogFile
}
# Check if custom arguments were defined
DS_WriteLog'I''File arguments: <no arguments defined>'$LogFile
DS_WriteLog'I''File arguments: $Arguments'$LogFile
DS_WriteLog'-''$LogFile
if($FileExt-eq'MSI'){
$FixedArguments='/x ''$File'' /qn /norestart /l*v ''$LogFileAPP''
$FixedArguments='/i ''$File'' /qn /norestart /l*v ''$LogFileAPP''
if([string]::IsNullOrEmpty($Arguments)){# check if custom arguments were defined
DS_WriteLog'I''Command line: Start-Process -FilePath 'msiexec.exe' -ArgumentList $arguments -Wait -PassThru'$LogFile
$process=Start-Process-FilePath'msiexec.exe'-ArgumentList$arguments-Wait-PassThru
$arguments=$FixedArguments+' '+$arguments
DS_WriteLog'I''Command line: Start-Process -FilePath 'msiexec.exe' -ArgumentList $arguments -Wait -PassThru'$LogFile
$process=Start-Process-FilePath'msiexec.exe'-ArgumentList$arguments-Wait-PassThru
}Else{
if([string]::IsNullOrEmpty($Arguments)){# check if custom arguments were defined
DS_WriteLog'I''Command line: Start-Process -FilePath ''$File'' -Wait -PassThru'$LogFile
$process=Start-Process-FilePath'$File'-Wait-PassThru
DS_WriteLog'I''Command line: Start-Process -FilePath ''$File'' -ArgumentList $arguments -Wait -PassThru'$LogFile
$process=Start-Process-FilePath'$File'-ArgumentList$arguments-Wait-PassThru
}
# Check the result (the exit code) of the installation
{
0{DS_WriteLog'S''The software was $Result1 successfully (exit code: 0)'$LogFile}
3{DS_WriteLog'S''The software was $Result1 successfully (exit code: 3)'$LogFile}# Some Citrix products exit with 3 instead of 0
1603{DS_WriteLog'E''A fatal error occurred (exit code: 1603). Some applications throw this error when the software is already (correctly) installed! Please check.'$LogFile}
1605{DS_WriteLog'I''The software is not currently installed on this machine (exit code: 1605)'$LogFile}
DS_WriteLog'E''The installation files cannot be found. The PS1 script should be in the root directory and all source files in the subdirectory 'Files' (exit code: 1619)'$LogFile
}
3010{DS_WriteLog'W''A reboot is required (exit code: 3010)!'$LogFile}
[string]$ExitCode=$Process.ExitCode
DS_WriteLog'E''The $Result2 ended in an error (exit code: $ExitCode)!'$LogFile
}
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_CopyFile
#
<#
Copy one or more files
Copy one or more files
This parameter can contain multiple file and folder combinations including wildcards. UNC paths can be used as well. Please see the examples for more information.
To see the examples, please enter the following PowerShell command: Get-Help DS_CopyFile -examples
This parameter contains the destination path (for example 'C:Temp2' or 'C:MyPathMyApp'). This path may also include a file name.
This situation occurs when a single file is copied to another directory and renamed in the process (for example '$Destination = C:Temp2MyNewFile.txt').
UNC paths can be used as well. The destination directory is automatically created if it does not exist (in this case the function 'DS_CreateDirectory' is called).
This works both with local and network (UNC) directories. In case the variable $Destination contains a path and a file name, the parent folder is
automatically extracted, checked and created if needed.
Please see the examples for more information.To see the examples, please enter the following PowerShell command: Get-Help DS_CopyFile -examples
DS_CopyFile -SourceFiles 'C:TempMyFile.txt' -Destination 'C:Temp2'
Copies the file 'C:TempMyFile.txt' to the directory 'C:Temp2'
DS_CopyFile -SourceFiles 'C:TempMyFile.txt' -Destination 'C:Temp2MyNewFileName.txt'
Copies the file 'C:TempMyFile.txt' to the directory 'C:Temp2' and renames the file to 'MyNewFileName.txt'
DS_CopyFile -SourceFiles 'C:Temp*.txt' -Destination 'C:Temp2'
Copies all files with the file extension '*.txt' in the directory 'C:Temp' to the destination directory 'C:Temp2'
DS_CopyFile -SourceFiles 'C:Temp*.*' -Destination 'C:Temp2'
Copies all files within the root directory 'C:Temp' to the destination directory 'C:Temp2'. Subfolders (including files within these subfolders) are NOT copied.
DS_CopyFile -SourceFiles 'C:Temp*' -Destination 'C:Temp2'
Copies all files in the directory 'C:Temp' to the destination directory 'C:Temp2'. Subfolders as well as files within these subfolders are also copied.
DS_CopyFile -SourceFiles 'C:Temp*.txt' -Destination 'localhostTemp2'
Copies all files with the file extension '*.txt' in the directory 'C:Temp' to the destination directory 'localhostTemp2'. The directory in this example is a network directory (UNC path).
[CmdletBinding()]
[Parameter(Mandatory=$true,Position=0)][String]$SourceFiles,
[Parameter(Mandatory=$true,Position=1)][String]$Destination
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Copy the source file(s) '$SourceFiles' to '$Destination'$LogFile
# Retrieve the parent folder of the destination path
# In case the variable $Destination contains a dot ('.'), return the parent folder of the path
}else{
}
# Check if the destination path exists. If not, create it.
DS_WriteLog'I''Check if the destination path '$TempFolder' exists. If not, create it'$LogFile
DS_WriteLog'I''The destination path '$TempFolder' already exists. Nothing to do'$LogFile
DS_WriteLog'I''The destination path '$TempFolder' does not exist'$LogFile
}
# Copy the source files
DS_WriteLog'I''Start copying the source file(s) '$SourceFiles' to '$Destination'$LogFile
Copy-Item$SourceFiles-Destination$Destination-Force-Recurse
DS_WriteLog'S''Successfully copied the source files(s) '$SourceFiles' to '$Destination'$LogFile
DS_WriteLog'E''An error occurred trying to copy the source files(s) '$SourceFiles' to '$Destination'$LogFile
}
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_DeleteDirectory
#
<#
Delete a directory
Delete a directory
This parameter contains the full path to the directory which needs to be deleted (for example C:TempMyOldFolder).
DS_DeleteDirectory -Directory 'C:TempMyOldFolder'
#>
Param(
[Parameter(Mandatory=$true,Position=0)][String]$Directory
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Delete directory $Directory'$LogFile
try{
DS_WriteLog'S''Successfully deleted the directory $Directory'$LogFile
DS_WriteLog'E''An error occurred trying to delete the directory $Directory (exit code: $($Error[0])!'$LogFile
}
DS_WriteLog'I''The directory $Directory does not exist. Nothing to do.'$LogFile
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_DeleteFile
#
<#
Delete a file
Delete a file
This parameter contains the full path to the file (including the file name and file extension) that needs to be deleted (for example C:TempMyOldFile.txt).
DS_DeleteFile -File 'C:TempMyOldFile.txt'
#>
Param(
[Parameter(Mandatory=$true,Position=0)][String]$File
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Delete the file '$File'$LogFile
try{
DS_WriteLog'S''Successfully deleted the file '$File'$LogFile
DS_WriteLog'E''An error occurred trying to delete the file '$File' (exit code: $($Error[0])!'$LogFile
}
DS_WriteLog'I''The file '$File' does not exist. Nothing to do.'$LogFile
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_CreateRegistryKey
#
<#
Create a registry key
Create a registry key
This parameter contains the registry path, for example 'hklm:SOFTWAREMyApp'
DS_CreateRegistryKey -RegKeyPath 'hklm:SOFTWAREMyApp'
Creates the new registry key 'hklm:SOFTWAREMyApp'
[CmdletBinding()]
[Parameter(Mandatory=$true,Position=0)][String]$RegKeyPath
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Create registry key $RegKeyPath'$LogFile
DS_WriteLog'I''The registry key $RegKeyPath already exists. Nothing to do.'$LogFile
try{
DS_WriteLog'S''The registry key $RegKeyPath was created successfully'$LogFile
catch{
DS_WriteLog'E''An error occurred trying to create the registry key $RegKeyPath (exit code: $($Error[0])!'$LogFile
DS_WriteLog'I''Note: define the registry path as follows: hklm:SOFTWAREMyApp'$LogFile
}
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_DeleteRegistryKey
#
<#
Delete a registry key
Delete a registry key
This parameter contains the registry path, for example 'hklm:SOFTWAREMyApp'
DS_DeleteRegistryKey -RegKeyPath 'hklm:SOFTWAREMyApp'
#>
Param(
[Parameter(Mandatory=$true,Position=0)][String]$RegKeyPath
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Delete registry key $RegKeyPath'$LogFile
try{
DS_WriteLog'S''The registry key $RegKeyPath was deleted successfully'$LogFile
catch{
DS_WriteLog'E''An error occurred trying to delete the registry key $RegKeyPath (exit code: $($Error[0])!'$LogFile
DS_WriteLog'I''Note: define the registry path as follows: hklm:SOFTWAREMyApp'$LogFile
}
DS_WriteLog'I''The registry key $RegKeyPath does not exist. Nothing to do.'$LogFile
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_DeleteRegistryValue
#
<#
Delete a registry value
Delete a registry value
This parameter contains the registry path (for example hklm:SOFTWAREMyApp)
This parameter contains the name of the registry value that is to be deleted (for example MyValue)
DS_DeleteRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyValue'
Deletes the registry value 'MyValue' from the registry key 'hklm:SOFTWAREMyApp'
[CmdletBinding()]
[Parameter(Mandatory=$true,Position=0)][String]$RegKeyPath,
[Parameter(Mandatory=$true,Position=1)][String]$RegValueName
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Delete registry value $RegValueName in $RegKeyPath'$LogFile
[string]$RegValueTemp=Get-ItemProperty-Path$RegKeyPath-ErrorActionSilentlyContinueSelect-Object-ExpandProperty$RegValueName-ErrorActionSilentlyContinue
if(($RegValueTemp::IsNullOrEmpty)-Or($RegValueTemp.Length-eq0)){
Remove-ItemProperty-Path$RegKeyPath-Name$RegValueNameOut-Null
DS_WriteLog'S''The registry value $RegValueName in $RegKeyPath was deleted successfully'$LogFile
DS_WriteLog'E''An error occurred trying to delete the registry value $RegValueName in $RegKeyPath (exit code: $($Error[0])!'$LogFile
DS_WriteLog'I''Note: define the registry path as follows: hklm:SOFTWAREMyApp'$LogFile
}
DS_WriteLog'I''The registry value $RegValueName in $RegKeyPath does not exist. Nothing to do.'$LogFile
}
end{
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_ImportRegFile
#
<#
Import a registry (*.reg) file into the registry
Import a registry (*.reg) file into the registry
This parameter contains the full path, file name and file extension of the registry file, for example 'C:TempMyRegFile.reg'
DS_ImportRegFile -FileName 'C:TempMyRegFile.reg'
Imports registry settings from the file 'C:TempMyRegFile.reg'
[CmdletBinding()]
[Parameter(Mandatory=$true,Position=0)][String]$FileName
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Import registry file '$FileName'$LogFile
try{
$process=start-process-FilePath'reg.exe'-ArgumentList'IMPORT ''$FileName''-WindowStyleHidden-Wait-PassThru
DS_WriteLog'S''The registry settings were imported successfully (exit code: $($process.ExitCode))'$LogFile
DS_WriteLog'E''An error occurred trying to import registry settings (exit code: $($process.ExitCode))'$LogFile
}
DS_WriteLog'E''An error occurred trying to import the registry file '$FileName' (exit code: $($Error[0])!'$LogFile
}
DS_WriteLog'E''The file '$FileName' does NOT exist!'$LogFile
}
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# FUNCTION DS_SetRegistryValue
#
<#
Set a registry value
Set a registry value
This parameter contains the registry path, for example 'hklm:SOFTWAREMyApp'
This parameter contains the name of the new registry value, for example 'MyValue'
This parameter contains the value of the new registry entry, for example '1'
This parameter contains the type (possible options are: String, Binary, DWORD, QWORD, MultiString, ExpandString)
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyStringValue' -RegValue 'Enabled' -Type 'String'
Creates a new string value called 'MyStringValue' with the value of 'Enabled'
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyBinaryValue' -RegValue '01' -Type 'Binary'
Creates a new binary value called 'MyBinaryValue' with the value of '01'
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyDWORDValue' -RegValue '1' -Type 'DWORD'
Creates a new DWORD value called 'MyDWORDValue' with the value of 1
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyQWORDValue' -RegValue '1' -Type 'QWORD'
Creates a new QWORD value called 'MyQWORDValue' with the value of 1
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyMultiStringValue' -RegValue 'Value1,Value2,Value3' -Type 'MultiString'
Creates a new multistring value called 'MyMultiStringValue' with the value of 'Value1 Value2 Value3'
DS_SetRegistryValue -RegKeyPath 'hklm:SOFTWAREMyApp' -RegValueName 'MyExpandStringValue' -RegValue 'MyValue' -Type 'ExpandString'
Creates a new expandstring value called 'MyExpandStringValue' with the value of 'MyValue'
[CmdletBinding()]
[Parameter(Mandatory=$true,Position=0)][String]$RegKeyPath,
[Parameter(Mandatory=$true,Position=1)][String]$RegValueName,
[Parameter(Mandatory=$false,Position=2)][String[]]$RegValue=',
[Parameter(Mandatory=$true,Position=3)][String]$Type
[string]$FunctionName=$PSCmdlet.MyInvocation.MyCommand.Name
DS_WriteLog'I''START FUNCTION - $FunctionName'$LogFile
DS_WriteLog'I''Set registry value $RegValueName = $RegValue (type $Type) in $RegKeyPath'$LogFile
# Create the registry key in case it does not exist
DS_CreateRegistryKey$RegKeyPath
try{
if(('String','ExpandString','DWord','QWord')-contains$Type){
New-ItemProperty-Path$RegKeyPath-Name$RegValueName-Value$RegValue[0]-PropertyType$Type-ForceOut-Null
New-ItemProperty-Path$RegKeyPath-Name$RegValueName-Value$RegValue-PropertyType$Type-ForceOut-Null
DS_WriteLog'S''The registry value $RegValueName = $RegValue (type $Type) in $RegKeyPath was set successfully'$LogFile
DS_WriteLog'E''An error occurred trying to set the registry value $RegValueName = $RegValue (type $Type) in $RegKeyPath'$LogFile
DS_WriteLog'I''Note: define the registry path as follows: hklm:SOFTWAREMyApp'$LogFile
}
DS_WriteLog'I''END FUNCTION - $FunctionName'$LogFile
}
#
# Main section #
$env:SEE_MASK_NOZONECHECKS=1
# Custom variables [edit]
$BaseLogDir='C:Logs'# [edit] add the location of your log directory here
$PackageName='Citrix Receiver for Windows'# [edit] enter the display name of the software (e.g. 'Arcobat Reader' or 'Microsoft Office')
# Global variables
$StartDir=$PSScriptRoot# the directory path of the script currently being executed
if(!($Installationtype-eq'Uninstall')){$Installationtype='Install'}
$LogDir=(Join-Path$BaseLogDir$PackageName).Replace(' ','_')
$LogFileName='$($Installationtype)_$($PackageName).log'
if(!(Test-Path$LogDir)){New-Item-Path$LogDir-ItemTypedirectoryOut-Null}
# Create new log file (overwrite existing one)
DS_WriteLog'I''START SCRIPT - $Installationtype $PackageName'$LogFile
###########################################################################
###########################################################################
# Delete old log folders in the TEMP directory (in case there are any)
$Folders=Get-ChildItem$env:Temp-filter'CTXReceiverInstallLogs*'
Foreach($Folderin$Folders){
}
DS_WriteLog'I''No existing log folders were found. Nothing to do.'$LogFile
# Only execute the following section during installation, not uninstallation
# Prevent the 'Add account' button right after installation
# Note 1: this section is not required in case you rename 'CitrixReceiver.exe' to 'CitrixReceiverWeb.exe' (but it also does no harm so you can leave it as it is)
# Note 2: 'CitrixReceiverWeb.exe' does NOT set the value 'EnableX1FTU' in the registry: it merely shows a Window at the end of the installation without the 'Add Account' button
DS_WriteLog'I''Prevent the 'Add account' button right after installation'$LogFile
DS_SetRegistryValue-RegKeyPath'hklm:SOFTWAREWow6432NodePoliciesCitrix'-RegValueName'EnableX1FTU'-RegValue'00000000'-Type'DWORD'
DS_WriteLog'-''$LogFile
###########################################################################
###########################################################################
# Install or uninstall software
$FileName='CitrixReceiver.exe'# [edit] enter the name of the installation file (e.g. 'MyApp.msi' or 'setup.exe')
$Arguments='/silent /uninstall'# [edit] enter arguments (for MSI file the following arguments are added by default: /i #File# /qn /norestart / l*v #LogFile#)
$Arguments='/silent /includeSSON /FORCE_LAA=1 EnableCEIP=false /AutoUpdateCheck=disabled'# [edit] enter arguments (for MSI file the following arguments are added by default: /i #File# /qn /norestart / l*v #LogFile#)
$FileSubfolder='Files'# [edit] enter the name of the subfolder which contains the installation file (e.g. 'Files' or 'MSI')
$FileFullPath=Join-Path$StartDir$FileSubfolder# Concatenate the two directories $StartDir and $InstallFileFolder
DS_InstallOrUninstallSoftware-File(Join-Path$FileFullPath$FileName)-InstallationType$Installationtype-Arguments$Arguments
DS_WriteLog'-''$LogFile
###########################################################################
###########################################################################
if($Installationtype-eq'Uninstall'){
# Reference: https://docs.citrix.com/en-us/receiver/windows/current-release/install/ica-install-manual.html
DS_WriteLog'I''Cleanup: delete the Citrix Receiver local machine keys'$LogFile
DS_DeleteRegistryKey-RegKeyPath'hklm:SOFTWAREPoliciesCitrixICA Client'
DS_DeleteRegistryKey-RegKeyPath'hklm:SOFTWAREWow6432NodePoliciesCitrixICA Client'
DS_DeleteRegistryValue-RegKeyPath'hklm:SOFTWAREWow6432NodePoliciesCitrix'-RegValueName'EnableX1FTU'
DS_DeleteRegistryValue-RegKeyPath'hklm:SYSTEMCurrentControlSetControlNetworkProviderProviderOrder'-RegValueName'PnSson'
DS_WriteLog'-''$LogFile
# POST-CONFIGURATION FOR INSTALLATIONS
# Import the Client Selective Trust registry keys and values. This prevents annoying security popup message regarding permissions for access to files, microphones, cameras, scanners, etc. in the local intranet and trusted sites.
# Reference: How to Configure Default Device Access Behavior of Receiver, XenDesktop and XenApp (https://support.citrix.com/article/CTX133565)
DS_WriteLog'I''Import the Client Selective Trust registry keys and values. This prevents security popup messages during logon'$LogFile
$RegFile=Join-Path$StartDir'FilesCitrixReceiver_Client_Selective_Trust_x86_Dennisspan.com.reg'
# -Delete the value data from the WEB_CLIENT registry value (part of the Citrix Online Plug-in MSI)
# -Each version of Citrix Receiver has its own product ID:
# -AC1889E2C14E5E540855164ACCB19FF3 -> Citrix Receiver 4.12 (this is the latest and last version of Receiver. The replacement for Receiver is Workspace app)
DS_WriteLog'I''Prevent unexpected MSI repairs from starting'$LogFile
DS_SetRegistryValue-RegKeyPath'hklm:SOFTWAREMicrosoftWindowsCurrentVersionInstallerUserDataS-1-5-18Products$($ProductID)Features'-RegValueName'WEB_CLIENT'-RegValue'-Type'String'
DS_WriteLog'-''$LogFile
# This section only runs on Windows 10 and higher
[int]$WindowsVersion=([environment]::OSVersion.Version).Major
# Reference: -https://support.citrix.com/article/CTX226423
# -http://www.carlstalhood.com/receiver-for-windows/#registryvalues
DS_WriteLog'I''Prevent the Win+G popup on Windows 10 machines'$LogFile
DS_SetRegistryValue-RegKeyPath'hklm:SOFTWAREPoliciesMicrosoftWindowsGameDVR'-RegValueName'AllowGameDVR'-RegValue'00000000'-Type'DWORD'
DS_WriteLog'-''$LogFile
# Fix the error ‘Failed to get network providers’ under Advanced Settings of the Network Adaptor when Citrix Receiver with Single Sign-on (SSON) is installed (reference: https://support.citrix.com/article/CTX229052)
# Note 1: this issue should be fixed from Windows 10 version 1803
# Note 2: in Windows 10 the provider order is based on the value of the particular item in the registry key 'HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNetworkProviderProviderOrder'
# By default, each network provider item gets a value of one thousands or higher, always an even 1000 value. For example: 1000, 2000, 3000, etc.
DS_WriteLog'I''Fix the error 'Failed to get network providers' under Advanced Settings of the Network Adapter'$LogFile
DS_SetRegistryValue-RegKeyPath'hklm:SYSTEMCurrentControlSetControlNetworkProviderProviderOrder'-RegValueName'PnSson'-RegValue'3001'-Type'DWORD'
DS_WriteLog'-''$LogFile
# Remove the shortcut from the 'ProgramsStartup' folder (if exist)
DS_WriteLog'I''Remove the Citrix Receiver shortcut from the 'ProgramsStartup' folder'$LogFile
$File=Join-Path$env:AllUsersProfile'Start MenuProgramsStartupReceiver.lnk'
# Remove the shortcut from the 'Programs' folder (if exist)
DS_WriteLog'I''Remove the Citrix Receiver shortcut from the 'Programs' folder'$LogFile
$File=Join-Path$env:AllUsersProfile'Start MenuProgramsCitrix Receiver.lnk'
}
# Do the following for both installations and uninstallations
# Determine the folder name containing the Citrix log files (e.g. C:WindowsTempCTXReceiverInstallLogs-20160218-202413)
DS_WriteLog'I''Copy the log files from the TEMP directory to '$LogDir'$LogFile
$CitrixLogPath=(gci-directory-path$env:Temp-filter'CTXReceiverInstallLogs*').FullName
$Source=Join-Path$CitrixLogPath'*.log'
DS_WriteLog'I''Destination directory = $LogDir '$LogFile
}else{
DS_WriteLog'I''There are no log files in the directory '$CitrixLogPath'. Nothing to copy.'$LogFile
###########################################################################
# Enable File Security
DS_WriteLog'I''End of script'$LogFile

To uninstall Receiver, execute the script as follows:

powershell.exe -executionpolicy bypass -file C:TempCitrixReceiverInstall_CitrixReceiver.ps1 Uninstall

The uninstallation removes any custom configuration the installation may have set as well as the following two registry keys:

  • HKLMSoftwarePoliciesCitrixICA Client
  • HKLMSoftwareWow6432NodePoliciesCitrixICA Client

Removing these two registry keys is recommended by Citrix (see the section Uninstalling Citrix Receiver for Windows in the article Install and Uninstall Citrix Receiver for Windows manually).

Conclusion

Installing and configuring Citrix Receiver can get quite complicated and requires a bit of planning. Also, please be aware of the following:

  • There are more settings that can be directly configured during the installation of Citrix Receiver. Most of these configurations concern the Windows registry. Please see the section Registry Values in Carl Stalhood's article Receiver / Workspace app 1808 for more information. In case you want to add additional configurations to the complete installation script, I recommend copying and reusing existing lines of code. Please be aware that many settings can nowadays be managed using Group Policy.
  • Citrix Receiver comes with a large collection of Group Policies settings. Please see the section Receiver Group Policy ADMX Template in Carl Stalhood's article Receiver / Workspace app 1808 for more information. The actual ADMX files can be downloaded on the Citrix website (in the section Downloads for admins), but they are also included in the installation directory of Receiver (C:Program Files (x86)CitrixICA ClientConfiguration).
  • Pass-through authentication (or single sign-on) requires many different settings to be correctly configured, such as Trusted Sites, Trust XML Requests on the Delivery Controller, installing the Single Sign-On component in Receiver and more. Please see the section Pass-through Authentication in Carl Stalhood's article Receiver / Workspace app 1808 for a complete overview of what needs to be configured. Citrix Receiver version 4.5 and higher comes with a build-in tool for checking the SSON configuration (see the Citrix article SSON Configuration Checker for Citrix Receiver for Windows).
  • The latest version of Receiver is also included in the installation sources of the Virtual Delivery Agent. On a Citrix worker, there are two possible strategies you can follow:
    1. You install Receiver as a stand-alone installation (as described in this article) and you install the Virtual Delivery Agent excluding Receiver. This is accomplished by using the command line /components VDA as described in the section Citrix Virtual Delivery Agent in my article Scripting the complete list of Citrix components with PowerShell.
    2. You install the version of Receiver included in the Virtual Delivery Agent installation sources (in this case you do not use the /components parameter).
  • When using Skype for Business in your environment, you may want to install the HDX RealTime Media Engine on your client device together with Citrix Receiver. Citrix Receiver is a prerequisite for the Media Engine; without Receiver, Media Engine cannot be installed. To automate the installation of the HDX RealTime Media Engine, please see the section HDX RealTime Media Engine for Windows in my article Scripting the complete list of Citrix components with PowerShell. Also, for extensive information on Skype for Business, Citrix and the HDX RealTime Optimization Pack, please see the section Skype for Business in Carl Stalhood's article Receiver / Workspace app 1808. I also highly recommend you to read the article Skype for Business with XenApp & XenDesktop written by Citrix CTP George Spiers.

If you want to go one step further and create an SCCM package as well, please follow the step-by-step explanation in the article Deep dive creating SCCM packages for Citrix.

I hope the information in this article was of some help to you. Happy scripting!

Related

Dennis Span
Dennis Span works as a Senior Citrix Architect for a large insurance company in Vienna, Austria. He holds multiple certifications such as CCE-V, CCIA and CCEA. In 2017, Dennis became a Citrix Technology Advocate (CTA). In 2019, he became a Citrix Technology Professional (CTP). Besides his interest in virtualization technologies and blogging, he loves spending time with his family as well as snowboarding, playing basketball and rowing. He is fluent in Dutch, English, German and Slovak and speaks some Spanish.