January 26, 2024

How To Optimize a Horizon Golden Image with the New Microsoft Teams Client

Use the workaround given in this post to install the new Microsoft teams client and still optimize the golden image to remove unwanted store apps.

Microsoft have announced the end of availability of the classic Teams client for the 31st of March 2024. The replacement is a new Microsoft store-based Teams app. Use the guidance below to help you understand how to install the new Teams app and optimize the image while retaining it.

One of the challenges is that, traditionally, the recommendation is to remove as many store apps as possible from a VDI image to optimize the performance. Unfortunately, the current version of the Windows OS Optimization Tool for VMware Horizon (OSOT) does not give you the option to selectively retain this new Teams client. Using the default OSOT settings all store apps are removed, although you can select certain store apps to retain. Currently the new Teams app is not one of those currently available to select to keep.

I chatted to the OSOT team and they are going to investigate what changes would be needed and when they could release an updated version.

Until the OS Optimization Tool can be updated to address this, I came up with the following workaround.

  1. Use the OS Optimization Tool but configure it to Keep all Windows Store Applications (Optimize > Common Options).
  2. Install the new Teams app.
  3. Use PowerShell to remove unneeded store apps.

Using the OS Optimization Tool

Use the OS Optimization tool more or less as you would normally. The only change you need to configure is to have it not delete any store apps when you optimize the image.

  1. Select the Common Options dialog.
  2. Open the Store Apps tab from the left-hand menu
  3. Select the option to Keep all Windows Store Applications.

For more information on the Common Options section of the OS Optimization Tool, see https://techzone.vmware.com/resource/windows-os-optimization-tool-vmware-horizon-guide#common-options

For the full process of building an optimized windows image, including using the OS Optimization Tool, see https://techzone.vmware.com/resource/manually-creating-optimized-windows-images-vmware-horizon-vms

Install the Teams App

To install the new Teams app into a Horizon 8 golden image, use the teamsbootstrapper.exe utility provided by Microsoft for VDI environments.

  1. Download the bootstrapper.exe utility.
  2. Download the Teams MSIX installation file.
  3. Open a Command Prompt as an Administrator
  4. Run the following command, modifying the path to match the location of where you downloaded the files to.

.\teamsbootstrapper.exe -p -o "c:\Users\Administrator\Downloads\MSTeams-x64.msix"

For full instructions on how to install the new Teams client for a Horizon 8 image, see https://learn.microsoft.com/en-us/microsoftteams/new-teams-vdi-requirements-deploy#vmware-horizon-and-workspace-one-requirements

PowerShell Commands to Remove Store Apps

The following two PowerShell commands are used to remove unwanted store apps, to optimize your golden image. These are essentially the same commands that the OSOT uses during this process.

You don’t just run those commands by themselves though. You will want to pass them a list of apps that we want to retain.

Controlling What Apps to Keep

To allow you to define which apps that you want to keep, we create an array variable ($AppsToKeep) that contains their names. The array will be used as a filter when the two PowerShell commands are run.

The example below includes the new Teams app (MSTeams), as well as the Windows Calculator and the new Windows Notepad app that come with Windows 11.

$AppsToKeep = @("Microsoft.WindowsStore", "Microsoft.StorePurchaseApp", "Microsoft.DesktopAppInstaller", "Microsoft.SecHealthUI", "Microsoft.WindowsCalculator", "Microsoft.WindowsNotepad", "MSTeams")

With Windows 11, I would recommend always retaining the following apps: Microsoft.WindowsStore, "Microsoft.StorePurchaseApp, "Microsoft.DesktopAppInstaller, and Microsoft.SecHealthUI

You can amend the $AppsToKeep variable to include other applications that you might want to keep. You can list the names of the installed store apps using the following:

  1. Open a Windows PowerShell console as an Administrator
  2. Run the following two commands:

$appx = Get-AppxPackage -AllUsers

$appx.name

Running the Commands

Once you have determined which store apps you want to retain and amended your $AppsToKeep array variable to include them, you are ready to run the PowerShell commands to remove the unwanted store apps.

Warning: It is extremely difficult to reinstall store apps that have been completely removed using the following process. I would recommend taking a virtual machine snapshot before running these commands. That allows you to rollback if you discover that you have removed apps that you realize you want to keep.

  1. Open a Windows PowerShell console as an Administrator
  2. Use the following commands

$AppsToKeep = @("Microsoft.WindowsStore", "Microsoft.StorePurchaseApp", "Microsoft.DesktopAppInstaller", "Microsoft.SecHealthUI", "Microsoft.WindowsCalculator", "Microsoft.WindowsNotepad", "MSTeams" )

Get-AppxPackage -AllUsers | Where-Object {$_.IsFramework -Match "False" -and $_.NonRemovable -Match "False" -and $_.Name -notin $AppsToKeep} | Remove-AppxPackage

Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -notin $AppsToKeep} | Remove-AppxProvisionedPackage -Online

Once the commands have completed running, you can check that the unwanted applications have been removed and are no longer available from the All Apps list in the Start Menu.

Summary

As Microsoft have announced the end of availability of the classic Teams client, you will have to switch to using the new store-based Teams app in the near future. Use the workaround described above to install the new Teams app and to remove unwanted store apps to continue optimizing your golden images.

When implementing Teams in a Horizon environment, be sure to read the guide on Microsoft Teams Optimization with VMware Horizon. We are looking at planning an update to that to cover changes need for the new Teams client.

Filter Tags

Horizon Horizon Blog Deploy