Removing the Built-in Microsoft Teams app with Intune – Take Two (a better approach)

In my last blog post, I wrote about using Win32 Apps as a better alternative to the Intune PowerShell feature for configuration changes. I also recently wrote about how to remove the new built-in Microsoft Teams app.

My friend Loryan Strant (Check out his awesome wisdom here) reached out and mentioned that he has seen some occurrences of the built-in Teams app reappearing some time after the PowerShell Script has been run to remove the App.

So taking my learnings from using the Win32 App approach, I though this method may be a good way to tackle the issue of the app reappearing.

The script used by the Intune PowerShell feature to remove the built-in Teams App can be reused as the Uninstall command for the Win32 App

Get-AppxPackage "*Teams*" -AllUsers | Remove-AppPackage –AllUsers

Now this is where things get a little bit different from what normally happens. The Win32 App needs an Install command, but we are not going to use the app to install anything as the sole purpose of this Win32 App is to remove the built-in Teams App

So the the install script can be a simple Write-Host command and nothing else.

Write-Host "This Script does nothing, zip, nada...  nothing at all to see here"

The last requirement is a detection script.

$TeamsApp = Get-AppxPackage "*Teams*" -AllUsers  -ErrorAction SilentlyContinue

if ($TeamsApp.Name -eq "MicrosoftTeams")
        Write-Output "Teams Built-in Present"
        Exit 0
        Write-Output "Teams Built-in Not Present"
        Exit 1603

To create the Win32 App you will need the Microsoft Win32 Content Prep Tool

Place all of the required scripts into a single folder

From a Terminal Window, run the IntuneWinAppUtil.exe

Specify the source folder, the setup file and the output folder.

The utility will then create a .intunewin file which can be uploaded to Intune.

Ensure the app information has the appropriate detail

Use the following Install and Uninstall commands:

powershell -executionpolicy bypass -file Install-TeamsBuiltIn.ps1
powershell -executionpolicy bypass -file Uninstall-TeamsBuiltIn.ps1

Add in the requirements that are appropriate to your environment

Use the detection script created earlier

Again, this is where things are little bit different. Instead of deploying this App as a Required assignment, deploy it as an Uninstall assignment.

I have chosen to use my Dynamic Device Azure AD group containing all of my Managed Windows devices using an Intune Filter Windows 11 Devices.

On my test device, I can now see that the built-in Teams App has (again) been removed.

I can also look in Intune and see that the Microsoft Teams – Built in App has a Resolved intent of Uninstall and the Installation status is Not installed

If the application does ever reappear on the device, Intune will pick up this up within the 8 hour data inventiry cycle, and the Installaton status the Microsoft Teams – Built in App will change to Installed.

Because this App has a Resolved intent of Uninstall, the uninstall command will run and the application will automatically be removed.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s