PowerShell script to detect CWA version and notify end user

Update 10-05-2021: Updated the script to include XenApp sessions as well. And removed some typo’s.

If you are running Microsoft Teams in a Citrix environment you know you need to have the correct version of the Citrix Workspace App (CWA). If the version is to old users don’t have an optimized Teams and so Audio/Video will not be great and more server resources are being used.

This PowerShell script will help you with that issue. You can add it to the logon script or use it to startup Teams. (then you need to tweak it a little bit though).

<#
This script checks the used CWA version for a minimum version.
If the used version is to old a popup will be shown asking to upgrade.

Version    : 1.3
Date       : 10 May 2021
Created by : Jeroen Tielen - Tielen Consultancy
Email      : jeroen@tielenconsultancy.nl

History:

1.0 : 10 November 2020 - Initial setup script.
1.1 : 02 December 2020 - Added PresentationFramework for machines not showing the warning box.
1.2 : 07 March 2021    - Added HTML5.
1.3 : 10 May 2021      - Removed typo's and added XenApp support (Thanks Jan Jonker and Ernst)
#>

$SessionId = [System.Diagnostics.Process]::GetCurrentProcess().SessionId
$InfoFromRegistry = Get-ItemProperty -Path HKLM:\SOFTWARE\Citrix\Ica\Session\$SessionId\Connection
$ClientVersion= $InfoFromRegistry.ClientVersion
$ClientPlatform = $InfoFromRegistry.ClientProductID # ClientProductID 1=Windows, 257=HTML5, 81=Linux, 82=Macintosh

# These are the minimum versions which support Teams offloading.
$MinimumWindowsVersion = "19.11.0.50"
$MinimumMacVersion = "20.9.0.17"
$MinimumLinuxVersion = "20.06.0.15"

Write-Host Client version in use: $ClientVersion

Add-Type -AssemblyName PresentationFramework

IF ($ClientPlatform -eq "1") {
  Write-Host "Running Windows"
  IF ([version]$ClientVersion -ge [version]$MinimumWindowsVersion) {
    Write-Host "OK, running correct version of Citrix Workspace App."
  } ELSE {
    [System.Windows.MessageBox]::Show("Warning: `n`nYou dont have the correct version of the Citrix Workspace App installed on the endpoint. Microsoft Teams will not run in HDX optimised mode.`n`nGo to https://receiver.citrix.com to download the latest version on your endpoint or contact your servicedesk.",'Update Citrix Workspace App','OK','WARNING')
  }
}

IF ($ClientPlatform -eq "82") {
  Write-Host "Running Macintosh"
  IF ([version]$ClientVersion -ge [version]$MinimumMacVersion) {
    Write-Host "OK, running correct version of Citrix Workspace App."
  } ELSE {
    [System.Windows.MessageBox]::Show("Warning:`n`nYou dont have the correct version of the Citrix Workspace App installed on the endpoint. Microsoft Teams will not run in HDX optimised mode.`n`nGo to https://receiver.citrix.com to download the latest version on your endpoint or contact your servicedesk.",'Update Citrix Workspace App','OK','WARNING')
  }
}

IF ($ClientPlatform -eq "81") {
  Write-Host "Running Linux"
  IF ([version]$ClientVersion -ge [version]$MinimumLinuxVersion) {
    Write-Host "OK, running correct version of Citrix Workspace App."
  } ELSE {
    [System.Windows.MessageBox]::Show("Warning:`n`nYou dont have the correct version of the Citrix Workspace App installed on the endpoint. Microsoft Teams will not run in HDX optimised mode.`n`nGo to https://receiver.citrix.com to download the latest version on your endpoint or contact your servicedesk.",'Update Citrix Workspace App','OK','WARNING')
  }
}

IF ($ClientPlatform -eq "257") {
  Write-Host "Running HTML5"
  [System.Windows.MessageBox]::Show("Warning:`n`nYou are working via HTML5 in this Citrix session. Install the Citrix Workspace App on your endpoint so you can use Microsoft Teams in HDX optimised mode.`n`nGo to https://receiver.citrix.com to download the latest version on your endpoint or contact your servicedesk.",'Update Citrix Workspace App','OK','WARNING')
}

Yeah I know, I could shorten the script 😉 Have fun with it and leave a comment when using it or when having issues.
Yes, you need to run it IN the HDX session.

4 thoughts on “PowerShell script to detect CWA version and notify end user

  1. Hi
    A little addition to your script… it only works on Workstation VDA. I used this on our Server VDA’s :

    $SessionId = [System.Diagnostics.Process]::GetCurrentProcess().SessionId
    HKLM:\SOFTWARE\Citrix\Ica\Session\$sessionid\Connection\

    to query the reg keys.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top