Thursday, November 4, 2021

CVAD Guide to Teams

This document was built on Slack, Citrix URLs, and Citrix Consultants from the field that shared how they successfully were able to get teams working 100% within Citrix. If you disagree and find something different, then let's update it. But the information Is shared among many people, and it is showing good results. I try to keep it updated around new blogs and actual experience in the area of installing teams in a CVAD environment.
  1. Different installer for Teams


  1. If you install Team.exe, this is the user installer. It will either install in the user profile or program data. 


  1. If you install the MSI version of Team, this is the Machine Wide installer. Citrix states they need the machine-wide installer.


  1. Uninstall Teams per user -clean up and redeployment procedure

  1. Uninstall user per team's installer before proceeding on Team machine installer

  2. You can have Citrix WEM run this for the user, inside their profile.

  3. Location: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run


  1. Option 1: 

  2. %LOCALAPPDATA%\Microsoft\Teams\Update.exe –uninstall –msiUninstall –source=default

  3. %Programdata%\Microsoft\Teams\Update.exe –uninstall –msiUninstall –source=default


  1. Option 2:

  2. Source Scripts https://github.com/Deyda/Teams

  3. https://docs.microsoft.com/en-us/microsoftteams/msi-deployment  ( Read this)


  1. C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -command set-executionpolicy bypass -Scope CurrentUser


  1. C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -File "\\domain\NETLOGON\CitrixScripts\WemExternalTask\TeamsUninstall-Users\TeamsUser-Uninstall.ps1" -NoProfile -Noninteractive



  1. The PS1 Script is from here https://github.com/Deyda/Teams


  1. But I changed the part in the Script to do it while the user is logged in.


$TeamsStartMenuShortcut = "c:\users\$env:USERNAME.$env:USERDOMAIN\Start Menu\Programs\Microsoft Corporation"

$TeamsDesktopShortcut = "c:\users\$env:USERNAME.$env:USERDOMAIN\Desktop\Microsoft

Teams.lnk"



  1. originally it was


$TeamsStartMenuShortcut = "\\domain\share\$env:USERNAME.$env:USERDOMAIN\Start Menu\Programs\Microsoft Corporation"

$TeamsDesktopShortcut = "\\domain\share\$env:USERNAME.$env:USERDOMAIN\Desktop\Microsoft Teams.lnk"


  1. Then I used a WEM external Task to run it.


  1. Block user installs

  • Deny access to C:\Users\*\AppData\Local\Microsoft\Teams

  • Use Fslogix appmasking

  • Note: if you have a machine install already installed and a user tries to click a link in outlook, it will open with the installed machine version. 


  1. Citrix Requirements

  • Minimum Version1906.2:

  • Best results are 1912

  • Virions -Optimization for Microsoft Teams requires a minimum of Microsoft Teams version 1.2.00.31357.



  1. We recommend you follow the Microsoft Teams machine-wide installation guidelines and avoid using the .exe installer that installs Teams in Appdata. Instead, install in C:\Program Files (x86)\Microsoft\Teams by using the ALLUSER=1 flag from the command line. In this mode, the 

  2.  Teams application doesn't auto-update whenever there is a new version. We recommend this mode for non-persistent environments. For more information, see Install Microsoft Teams using MSI (VDI Installation section).



  1. Microsoft VDI


https://docs.microsoft.com/en-us/microsoftteams/teams-for-vdi#install-the-teams-desktop-app-on-vdi


These examples also use the ALLUSERS=1 parameter. When you set this parameter, Teams Machine-Wide Installer appears in Programs and Features in Control Panel and in Apps & features in Windows Settings for all users of the computer. All users can then uninstall Teams if they have admin credentials. It's important to understand the difference between ALLUSERS=1 and ALLUSER=1. The ALLUSERS=1 parameter can be used in non-VDI and VDI environments, and the ALLUSER=1 parameter is used only in VDI environments to specify a per-machine installation.


  1. Dedicated VDI (updated)

You have Windows 10 dedicated, persistent VDI environments. You want the Teams application to auto-update and would prefer Teams to install per-user under Appdata/Local, use the .exe installer or the MSI without ALLUSER=1. (I don't know if they will be optimized for Citrix though?)


Update 8/18/2020

I confirmed that it's still optimized as well on the user install. I was wondering this, and now I know.


Non-Presisten VDI or RDSH (XenApp)

  • ALLUSERS=1:  Teams Machine-Wide Installer appears in Programs and Features in Control Panel and in Apps

  • ALLUSER=1: used only in VDI environments to specify a per-machine installation, and turns off auto updater in non-persistent machines.

  • noAutoStart=true: tells it when installing set it not to autostart.



  1. Per-machine installation for VDI

/l*v  ALLUSER=1 ALLUSERS=1

msiexec /i <path_to_msi> /l*v <install_logfile_name> ALLUSER=1 ALLUSERS=1

msiexec /i Teams_windows_x64.msi ALLUSER=1 ALLUSERS=1

msiexec /i Teams_windows_x64.msi OPTIONS="noAutoStart=true" ALLUSER=1 ALLUSERS=1

msiexec /i "%temp%\Teams_windows_x64.msi" /QN OPTIONS="noAutoStart=true" ALLUSER=1 ALLUSERS=1



  1. Container Profile exclusions

<Exclude Copy="0">AppData\Local\Microsoft\Teams\Current\Locales</Exclude>

<Exclude Copy="0">AppData\Local\Microsoft\Teams\Packages\SquirrelTemp</Exclude>

<Exclude Copy="0">AppData\Local\Microsoft\Teams\current\resources\Locales</Exclude>

<Exclude Copy="0">AppData\Roaming\Microsoft\Teams\Service Worker\CacheStorage</Exclude>

<Exclude Copy="0">AppData\Roaming\Microsoft\Teams\Application Cache</Exclude>

<Exclude Copy="0">AppData\Roaming\Microsoft\Teams\Cache</Exclude>          

<Exclude Copy="0">AppData\Roaming\Microsoft Teams\Logs</Exclude>

<Exclude Copy="0">AppData\Roaming\Microsoft\Teams\media-stack</Exclude>


  1. UPM File based

  • .txt files from location %AppData%\Microsoft\Teams

  • %AppData%\Microsoft\Teams\media-stack

  • %AppData%\Microsoft\Teams\Cache

  • %AppData%\Microsoft\Teams\GPUCache

  • %AppData%\Microsoft\Teams\meeting-addin\Cache

  • %AppData%\Microsoft\Teams\Service Worker\CacheStorage




Red don't use: AppData\Local\Microsoft\Teams as it will break some pieces in the Citrix discussion below.

https://discussions.citrix.com/topic/406559-fslogix-vhd-size-dramatically-different-from-actual-file-content-size-and-will-not-compress/page/6

Source: https://virtualwarlock.net/microsoft-teams-in-citrix/

Source2: https://james-rankin.com/articles/quickpost-how-to-stop-fslogix-profile-containers-bloating-when-running-microsoft-teams/





  1. Warning and issues (Dang Json Files are just a pain and don't seem to get honored very well.)


Running the MSI in VDI mode by using the switch Alluser=1 makes teams completely ignore  JSON files.  It ignores the setup.json, and it ignores the desktop-config.json file. Redirecting it to any other json file anywhere else won't help as it doesn't respect JSON files. It must be a bug. Still trying to work through this.



  1.   Disable Teams auto-launch

  1. Disable Teams auto-launch after installation

Delete Teams reg keys following locations

HKEY_LOCAL_MACHINE \SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run 

HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows\CurrentVersion\Run

HKEY_CURRENT_USER \SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Then apply GPO, not to auto Launch Teams. 


  1. Note that currently, it is not possible to disable Auto-start even if using the command line flag OPTIONS="noAutoStart=true" with the machine-wide MSI and the ALLUSER=1 property. Deleting the reg key described in bullet#2 (bullet#2 is on the citrix doc) should fix this.


Source: 

https://support.citrix.com/article/CTX253754

https://docs.microsoft.com/en-us/microsoftteams/scripts/powershell-script-teams-reset-autostart



  1. If you have profiles that have auto-launch already set, then you will have to run this Script to clear out the settings. If you want to use the "Prevent Microsoft Teams from starting automatically after installation. Group Policy setting, make sure you first set the Group Policy setting to the value you want before you run this Script. 


Teams-AutostartResetCU

        Source Scripts https://github.com/Deyda/Teams



  1. Doing Auto Launch with Teams is CPU intensive. Control it with WEM on auto-launch, It will allow the Shell to load first.





Source: https://virtualwarlock.net/microsoft-teams-in-citrix/



  1. James Ranklin method of disable auto-setup, enable auto-start once the setup is triggered manually by the user, and also make sure that the openAsHidden flag is actually respected. Scroll down to "Solving It"

https://james-rankin.com/articles/microsoft-teams-on-citrix-virtual-apps-and-desktops-part-1-installing-the-damned-thing/

Microsoft Teams on Citrix Virtual Apps and Desktops, part #2 – default settings and JSON wrangling – JAMES-RANKIN.COM

Microsoft Teams on Citrix Virtual Apps and Desktops, part #3 – 18 tips for optimizing performance – JAMES-RANKIN.COM




  1. Disable GPU offload because teams will have HIGH CPU usage (no video card)

(Run this with WEM)


Source: https://www.itexperience.net/fix-performance-issues-teams-high-cpu-memory-usage/

Source: Slack

 

$ErrorActionPreference = 'SilentlyContinue'

$JsonFile = [System.IO.Path]::Combine($Env:AppData, 'Microsoft', 'Teams', 'desktop-config.json')

$ConfigFile = Get-Content -Path $JsonFile -Raw | ConvertFrom-Json

Try {

    $ConfigFile.appPreferenceSettings.openAtLogin = $False

    $ConfigFile.appPreferenceSettings.disableGpu = $True

} Catch {

    Write-Host  "JSON element doesn't exist"

}

$ConfigFile | ConvertTo-Json -Compress | Set-Content -Path $JsonFile -Force 


Update as of October 21st, 2020. This seems to work really well.

https://github.com/Mohrpheus78/Microsoft/blob/main/Teams%20User%20Settings.ps1?s=03



Updaet as of November 4, 2021

if (!(Test-Path $env:AppData\Microsoft\Teams\desktop-config.json)) {Exit} $JSONFile = $env:AppData+"\Microsoft\Teams\desktop-config.json" $User = $env:USERDOMAIN+'\'+$env:USERNAME $JSON = Get-Content $JSONFile | ConvertFrom-Json if ($JSON.appPreferenceSettings.disableGpu -eq $False) { Get-Process -Name 'Teams' -IncludeUserName -ErrorAction SilentlyContinue | Where-Object UserName -eq $User | Stop-Process -Force $JSON.appPreferenceSettings.disableGpu = $True $JSON | ConvertTo-Json | Out-File $JSONFile -Encoding ASCII & "C:\Program Files (x86)\Microsoft\Teams\current\Teams.exe" }


Source

Microsoft Teams Optimization on Citrix – JGSpiers.com


  1. For this I did a WEM external Task that does the following

C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -command set-executionpolicy bypass -Scope CurrentUser



C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -File "\\domain.org\NETLOGON\CitrixScripts\WemExternalTask\DisableGPUTeams_VDI\disableGPUTeams.ps1" -NoProfile -Noninteractive


  1. Monitoring Teams with HDX Monitor

    On 1912 VDAs (or higher), you can monitor an optimized active call using HDX Monitor (3.5.2 or higher).
    To turn this on, create the following WebrtcDirectorIntegration reg key on the VDA:

    HKLM\Software\Citrix\HDXMediaStream\
    Or
    HKLM\SOFTWARE\WOW6432Node\Citrix\HdxMediaStream
    - reg key value:
    name: WebrtcDirectorIntegration
    type: DWORD
    value: enable(1), disable(0)



  1. Enable Team in Citrix

Enable optimization of Microsoft Teams

To enable optimization for Microsoft Teams, use the Studio policy described in Microsoft Teams redirection policy (it is ON by default). In addition to this policy being enabled, HDX checks to verify that the version of the Citrix Workspace app is equal to or greater than the minimum required version. If you enabled the policy and the Citrix Workspace app version is supported, the HKEY_CURRENT_USER\Software\Citrix\HDXMediaStream\MSTeamsRedirSupport registry key is set to 1 automatically on the VDA. The Microsoft Teams application reads the key to load in VDI mode.


NOTE:


If you are using version 1906.2 VDAs or higher with older Controller versions (for example, version 7.15), which do not have the policy available in Studio, you can still be optimized because HDX optimization for Microsoft Teams is enabled by default in the VDA.


If you click About > Version, the Citrix HDX Optimized legend displays:


Optimized for Citrix legend


Recommended version – Citrix Workspace app 2006.1 for Windows and Minimum version - Citrix Workspace app 1907 for Windows:


Source: https://docs.citrix.com/en-us/citrix-virtual-apps-desktops/multimedia/opt-ms-teams.html



  1. Troubleshooting MS teams in Citrix 

material is copied from other sources, and is not my materials. You will see word for word references in blogs. This is be trying to pull it all together in one area.

https://support.citrix.com/article/CTX253754

Microsoft Teams Optimization on Citrix – JGSpiers.com




  1. To prevent Teams from installing in Office updates.

  2. If your organization isn't ready to deploy Teams and you use Group Policy, you can enable the Don't install Microsoft Teams with new installations or updates of Office policy setting. You can find this policy setting under Computer Configuration\Policies\Administrative Templates\Microsoft Office 2016 (Machine)\Updates.


It will add this key.





  1. If you do get teams to install from office updates (Which I had and I didn't relize it) you will see team auto start upon loggin in. 


You will see this.


User auto Start HKCU\Software\Microsoft\WIndows\Current Verison\Run

C:\Users\%username%\AppData\Local\Microsoft\Teams\Update.exe --processStart "Teams.exe" --process-start-args "--system-initiated"




Machine auto Start

HKLM\Software\\WOW6432Node\Microsoft\WIndows\Current Verison\Run

%ProgramFiles%\Teams Installer\Teams.exe --checkInstall --source=PROPLUS



See here for a list of troubleshooting tips from Citrix.

  1. Check Teams is optimized.

When Teams is running optimized, the HdxRtcEngine.exe process runs on the endpoint and the WebSocketAgent.exe process runs on the VDA.

  1. Check status of services

There are a couple of services required to be running on the VDA for successful Teams optimization.

  • Citrix HDX Teams Redirection Service: Provides establishment of virtual channel used with Microsoft Teams.

  • Citrix HDX HTML5 Video Redirection Service: Responsible for TLS termination of secure WebSockets and spawning the WebSocketAgent.exe process into user sessions when Teams starts. This service also runs as WebSocketService.exe and needs to be listening on 127.0.0.1:9002. You can confirm this using command netstat -anob -p tcp | findstr 9002 on the VDA.

On successful connection, the state turns to ESTABLISHED.

  1. Using HDX Monitor

The latest versions of HDX Monitor allow you to see some information about active Teams calls.

When viewing session information via HDX Monitor, if the Number of connections under Webrtc is set to 0, either Teams has not been launched within the session or has been launched but is not optimized.

Text

Description automatically generated

When Teams is running optimized, the Number of connections for the session will change to 1.

Text

Description automatically generated

When a Teams call is in progress, the Virtual channel state will switch from Idle to Active. HDX Monitor will also show you the maximum Kbps outgoing and incoming bandwidth used for the entire HDX session over all Teams calls.

Graphical user interface, text, application, email

Description automatically generated

  1. Logs

There are various logs you can turn to when troubleshooting HDX Optimization for Teams.

Client Endpoint (Windows)
  • Folder: %LocalAppData%\Temp\HdxRtcEngine

  • Contains hdxrtcengine.log and webrpc.log.

Additionally, there are log files stored on Mac and Linux endpoints, and you also have the option of enabling CDF tracing using specific trace providers.

VDA Trace Providers
  • HDX_Multimedia_TeamsService

  • HDX_Multimedia_WebSocketAgent

  • HDX_Multimedia_WebSocketPipe

  • HDX_Multimedia_WebSocketService

Endpoint Trace Providers
  • IcaClient_Multimedia_HdxRtcEngine_CtlGuid

  • IcaClient_DriversVd_TeamsRedir_CtlGuid

  1. Basic troubleshooting steps

  1. Confirm you are running a compatible version of Workspace app. Refer to the Endpoint software requirements section.

  2. Confirm that HdxRtcEngine.exe is running on the endpoint and WebSocketAgent.exe is running on the VDA. If not, exit Teams on the VDA.

  3. Start Teams and check again if the aforementioned processes are running.

  4. If the processes are still not running or Teams is not optimized, restart the Citrix HDX Teams Redirection Service (if possible) and disconnect from your ICA session, then reconnect.

  5. If the processes are still not running or Teams is not optimized, completely log off the VDA and back on, or reboot the VDA and/or endpoint.

Known Limitations

The documentation for each Citrix Virtual Apps and Desktops release contains a section containing known limitations that are either Citrix limitations, Microsoft limitations, or both.

The example URL is for Virtual Apps and Desktops 7 2190: https://docs.citrix.com/en-us/citrix-virtual-apps-desktops/multimedia/opt-ms-teams.html#known-limitations

Misc. links




All of this is references from Slack and conversations, virtual Warlock Site, and Citrix Troubleshooting Docs

https://virtualwarlock.net/microsoft-teams-in-citrix/

https://support.citrix.com/article/CTX253754 

Microsoft Teams Optimization on Citrix – JGSpiers.com



  1. Outlook Plugin appears to break at times or may never load.

For it not loading, Please follow Kasper's guide here

https://virtualwarlock.net/microsoft-teams-in-citrix/

Search for "Teams Outlook Add-in" on his page.


  1. Outlook Plugin appears to break at times and this is what I have found so far that fixes it.

Copy the two folders from C:\Program Files (x86)\Microsoft "TeamMeetingAddin" and TeamsPresenceAdmin" to C:\Users\%username%\AppData\Local\Microsoft.
The run this
%SystemRoot%\System32\regsvr32.exe /s /n /i:user %LocalAppData%\Microsoft\TeamsMeetingAddin\1.0.19317.2\x64\Microsoft.Teams.AddinLoader.dll
%SystemRoot%\SysWOW64\regsvr32.exe /s /n /i:user %LocalAppData%\Microsoft\TeamsMeetingAddin\1.0.19317.2\x86\Microsoft.Teams.AddinLoader.dllthis version number in I pasted might be different, Based on what you have installed. (edited) 

Then about 5 minutes later, this was showing.



  1. I was updated that, screen sharing may act up. If this happens, removed the Contents from AppData, and all Teams data. Then allow it to rebuild the files etc.




19. How to Fix Microsoft Teams Screen Sharing not Working Issue

Troubleshoot Microsoft Teams screen sharing not working (airmore.com)




No comments:

Post a Comment