Remove built-in Teams app and Chat Icon in Windows 11 during a Feature Update via SetupConfig.ini and SetupComplete.cmd

Introduction

This topic in particular, has been very popular since the release of Windows 11 back in October last year.

At this point, there’s at least a dozen posts out there, on how to remove either the built-in Teams app or the Chat Icon from the task bar on devices running Windows 11 already.

I’m in the middle of preparing Windows 11 for broad deployment myself, and this is how I make sure the built-in Teams app and Chat Icon is removed before the user logs on to Windows 11 for the first time. In this scenario, after completing the Feature Update coming from Windows 10.

Preliminary details

To keep it short and sweet for now, this post assumes you know a little something on the SetupConfig.ini file as well as the custom action script SetupComplete.cmd.

If not, there are some reading to do in the links down below. I will elaborate greatly on these topics in a near future, covering my Windows 11 WaaS process, but for now you’re better off knowing something already.

PowerShell

I have created something for you, to do most of the work in terms of creating the SetupConfig.ini as well as the SetupComplete.cmd files.

  • NOTE: The content here are light versions of the final products of my Windows 11 process. For now, I’m only including the content relevant to the topic of the blog post. 🙂

FU-Script.ps1

This is the one and only script you actually need in this context.

The script is located here on my GitHub repository: Windows-11/FU-Script.ps1 at main · imabdk/Windows-11 (github.com)

I will walk through what the script does in details:

Creating folder and scripts

The script will create a FeatureUpdate folder in ProgramData which will contain following files:

  • PostRollBack.cmd
  • PostRollBack.ps1
  • SetupComplete.cmd
  • SetupComplete.ps1

Creating folder and SetupConfig.ini

The script will also create a Microsoft\Windows\WSUS folder in LocalAppData of the Default user profile, which then will contain a SetupConfig.ini file:

SetupConfig.ini

The content of the SetupConfig.ini file is similar to below and it’s content can be modified in the FU-Script.ps1 file:

The function Create-SetupConfigIni and essentially the iniFileContent variable, is where you modify the content of the SetupConfig.ini file saved into above folder:

SetupComplete

Two files are created in relation to SetupComplete: SetupComplete.cmd and SetupComplete.ps1.

SetupComplete.cmd is used to reference a more flexible PowerShell script of the same name: SetupComplete.ps1

Batch

PowerShell

Similar to the content of the SetupConfig.ini file, you have the ability to modify the content of the SetupComplete.ps1 file via FU-Script.ps1:

Chain of Events

To sum it up, these are the chain of events happening:

  • Run FU-Script.ps1 as a preliminary step using Intune or Configuration Manager
    • FU-Script.ps1 will stage the required files: SetupConfig.ini as well as SetupComplete.cmd/ps1
  • When the Windows 11 Feature Update is downloaded and run, SetupConfig.ini will be read and used
    • This will instruct the Windows setup to run SetupComplete.cmd POSTOOBE, translated into AFTER a successful upgrade
      • Which in return will run SetupComplete.ps1 and therefore remove the built-in Teams app and hide the chat icon

ENJOY 🙂

Leave a Comment

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