Jump to content
Welcome to our new Citrix community!
  • How to Check the MS Teams Optimization State


    dennismohrmannrnd.png by Dennis Mohrmann, CTA

    The situation

    Many of us now use MS Teams on Citrix desktops (also because of Covid-19). For MS Teams to run satisfactorily, the “Citrix Teams optimization” should always be active. This isn’t always the case, often the client is not ready for the optimization or requirements are missing, especially on Linux clients.

    It is very difficult for the user to recognize whether MS Teams is running optimally, the normal way would be this:


    I hardly know a user who does that. The result is that in the worst-case scenario, a user will not know that Teams is NOT running optimally. We can expect the user to complain.

    Therefore, I created a PowerShell script that determines, after the start of teams, whether the optimization is active or not.

    The challenge

    To determine the optimization status, we need a WMI query. Before doing this, we have to create a registry value on the VDA, otherwise we will not receive the information.

    The value can be found in the Citrix article https://support.citrix.com/article/CTX253754


    name: WebrtcDirectorIntegration

    type: DWORD

    value: 1

    Without the value the query looks like this:

    Get-WmiObject -Namespace root\citrix\hdx -Class  Citrix_VirtualChannel_Webrtc_Enum | where 'SessionID' -eq <sessionID>

    Component_VersionEndpoint     :

    Component_VersionReceiver     :

    Component_VersionTypescript   :

    Component_VersionVda          :

    Component_VersionWebrpc       :

    Component_VersionWebrtcCodec  :

    After the registry key has been set, we get the following information after starting Teams and wait a couple of seconds. We don’t need a reboot to get it.

    Get-WmiObject -Namespace root\citrix\hdx -Class  Citrix_VirtualChannel_Webrtc_Enum | where 'SessionID' -eq <sessionID>

    Component_VersionEndpoint     :

    Component_VersionReceiver     :

    Component_VersionTypescript   :

    Component_VersionVda          :

    Component_VersionWebrpc       :

    Component_VersionWebrtcCodec  :

    Depending on the client, different information is shown here. The Windows client offers most of the information. After many tests with different clients (Windows, Mac, Linux), I found out that one value is displayed on all end devices when Teams is running optimally.


    The value that is interested here is:



    If it says, Teams is NOT optimized. So, we take this value as a basis.

    The challenge now is to check whether Teams is optimized in the current user session or not after starting Teams. My first approach was the method that fellow CTP James Rankin described here. A scheduled task monitors the Teams.exe process and starts the script, which in turn carries out the optimization check. But we're dealing with Teams here 😉, shortly after the first start, other Teams processes are added, so the script is triggered again and again. Unfortunately, the approach from James is not to be used here.

    Another method must be found. For the moment, I decided to replace the actual MS Teams shortcut and let the user launch the script directly, which first calls Teams.exe, waits long enough and then carries out the check. If you have better ideas, please let me know 😉. Maybe Guy Leech has a good method, I will figure this out soon.


    If you use WEM, GPP or another user environment tool, you can simply define the shortcut for Teams. Instead of using “C:\Program Files (x86)\Microsoft\Teams\current\Teams.exe” we use the PowerShell script.

    Using WEM, for example, the application would look like this:

    Command line:


    Working directory:

    C:\Program Files (x86)\Microsoft\Teams\current


    -executionpolicy bypass -windowstyle hidden -file "C:\Program Files (x86)\Scripts\Check Teams optimization.ps1"

    Of course, you have to edit the path of the script depending on where you put it.

    The script

    You find the script to check the Teams status on my GitHub repository:

    Citrix/Teams Optimization check at main · Mohrpheus78/Citrix · GitHub

    This script will check if the MS Teams Citrix Optimization is working after starting Teams. After 25 sec. (launch time of Teams) the user gets a toast notification if the optimization is NOT active.

    A log for each client gets written to the "Logging" folder (which must exist with write permissions for users!). Of course, you can change the sleep time and the logging location.

    For the user to launch the script, you need to create a shortcut. Replace the shortcut with the standard Teams shortcut as described above.

    Attention: you need the BurntToast PowerShell module on the client/server to display the notification.

    BurntToast needs an AppId to display the notifications, default is Windows PowerShell. BurntToast will check the start menu for the shortcut, no message is shown if PowerShell cannot be found. In many cases, admins hide the PowerShell shortcuts from the users' start menu, so you have to define your own AppId. To define you own AppId, you have to place a shortcut in the start menu and use this as your AppId. The name of the AppId will be displayed at the bottom of the notification. To find out how to define the AppID, run "Get-StartApps" in the user session. You get a list of possible values.

    In this case, use MS Teams as AppID, a shortcut to this PowerShell script must exist in the start menu!

    You get more information about the AppID here:

    https://docs.microsoft.com/en-us/windows/win32/shell/appids and here https://toastit.dev/2018/02/04/burnttoast-appid-installer/

    The script will first find the current session ID and the clientname of the user and what client platform/version is used in this session. The display language is determined to display the notification in the correct language. The toast notification appears longer than the default value, you can change this as well (short instead of longer).

    If Teams is NOT optimized the user should get a notification:


    Something else? Yes!

    Citrix just released a new WorkspaceApp 2103.1 for Windows with enhancements for MS Teams. Users should update the CWA if they use Teams on the VDA: You could use my other script (Citrix/Citrix Client notification at main · Mohrpheus78/Citrix · GitHub) to inform users that they should update the CWA, especially if you have WFH or BYOD users and you don’t have access to their clients.

    So, that’s it! I hope the scripts are useful for you, it looks like Microsoft and Citrix are working on their own solution for informing the users about the optimization state, maybe the script is no longer needed or is an inspiration for similar tasks.

    If you have any questions, contact me via Twitter @mohrpheus78 or via GitHub 🙂


    Dennis Mohrmann | Citrix CTA

    User Feedback

    Recommended Comments

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...