Monday, April 25, 2016

PowerShell: Download and Install Citrix Receiver

I have been doing quite a bit of work lately on PowerShell scripting for work and this is a common one we deploy to our clients that use Citrix.

This script does the following:
  1. Creates the folder C:\Install\CitrixReceiver
  2. Downloads the latest Citrix Receiver software from the Citrix website
  3. Installs the downloaded Receiver silently
The link for the Citrix Receiver is: http://downloadplugins.citrix.com/Windows/CitrixReceiver.exe

Works with PowerShell v2 and higher.
A lot of my scripts are built to work at this level as it means that I can deploy my scripts to older machines without having to first upgrade PowerShell.

Copy and paste the code into a text file called InstallCitrixReceiver.ps1.



# --------------------------------------------------------------------------
#                Citrix Receiver Install Script
#                   Date: 14-Mar-2016
#               Created by: Daniel Burrowes
# --------------------------------------------------------------------------

# -Verbose and -Debug

[CmdletBinding()]
param()

# --------------------------------------------------------------------------
#  Change Log
#
#  14-Mar-2016
# -Added /IncludeSSON to argument list
# --------------------------------------------------------------------------

#Create install directory
Write-Verbose "Creating Install Directory"
$InstallDir = "C:\Install\CitrixReceiver"
New-Item -Path $InstallDir -ItemType directory -Force


Function Download-Citrx {

 $Source = "http://downloadplugins.citrix.com/Windows/CitrixReceiver.exe"
 $destination = "C:\Install\CitrixReceiver\CitrixReceiver.exe"

    Write-Verbose "Downloading Software..."
    (New-Object System.Net.WebClient).DownloadFile($Source, $Destination)
    Write-Verbose "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)" 

}

Write-Verbose "Downloading Latest Citrix Receiver"
Download-Citrx

Write-Verbose "Running silent install of Citrix Receiver"
Start-Process -FilePath "C:\Install\CitrixReceiver\CitrixReceiver.exe" -ArgumentList "/silent /IncludeSSON" -Wait -Verbose -PassThru

Executing Powershell scripts may require you to allow scripts to run.:
#Set-Execution Policy -RemoteSigned

4 comments:

  1. Does this install in administrator mode so that the install is on the machine rather than in the users app data??

    ReplyDelete
    Replies
    1. Assuming you run the script as an administrator. All installs i have done with this installed it to the machine, not the user.

      Delete
  2. Hi, when I ran below line

    Start-Process -FilePath ".\CitrixReceiver.exe" -ArgumentList "/silent /IncludeSSON" -Wait -Verbose -PassThru -Verb runAs

    it is pops up new window and asking for confirmation. how to suppress this aswell. I need silent installation. It should not ask any confirmation. Could you please help me on this?

    ReplyDelete
  3. Hi Daniel,

    when I ran below I am getting pop up window and asking for confirmation. how to suppress this confirmation window. I need silent installation. it should not ask any confirmation. Could you please help on this.

    Start-Process -FilePath ".\CitrixReceiver.exe" -ArgumentList "/silent /IncludeSSON" -Wait -Verbose -PassThru -Verb runAs

    ReplyDelete