Automation Citrix Deploy Install PowerShell Recevier script scripting

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:InstallCitrixReceiver
  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:InstallCitrixReceiver"
New-Item -Path $InstallDir -ItemType directory -Force


Function Download-Citrx {

$Source = "http://downloadplugins.citrix.com/Windows/CitrixReceiver.exe"
$destination = "C:InstallCitrixReceiverCitrixReceiver.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:InstallCitrixReceiverCitrixReceiver.exe" -ArgumentList "/silent /IncludeSSON" -Wait -Verbose -PassThru
Executing Powershell scripts may require you to allow scripts to run.:
#Set-Execution Policy -RemoteSigned