This should be everything you need to kill Microsoft Teams. I use a compiler to create EXEs, and then upload those to SCCM & Intune.
But you can test locally to make sure all the code is working fine before creating self-contained packages.
Application Names
MSTeams_24165.1414.2987.41_x64__8wekyb3d8bbwe
MicrosoftTeams_24165.1306.2986.9504_x64__8wekyb3d8bbwe
Application GUID
{731F6BAA-A986-45A4-8936-7C3AAAAA760B}
Plugin GUID
{A7AB73A3-CB10-4AA5-9D38-6AEFFBDE4C91}
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760B}
Current User Script
:: MrNetTek
:: eddiejackson.net
:: 7/24/2024
:: free for public use
:: free to claim as your own
@echo off
setlocal
:: Set the setup directory
set "setupDir=C:\setup"
if not exist "%setupDir%" mkdir "%setupDir%"
:: Terminate running Teams processes
taskkill /f /im teams.exe >nul 2>&1
taskkill /f /im TUninstall.exe >nul 2>&1
:: Uninstall Teams using TUninstall.exe
if exist "%setupDir%\TUninstall.exe" (
start /wait "" "%setupDir%\TUninstall.exe" --uninstall -s
timeout /t 5
)
:: Uninstall Teams using Update.exe
if exist "%LOCALAPPDATA%\Microsoft\Teams\Update.exe" (
"%LOCALAPPDATA%\Microsoft\Teams\Update.exe" --uninstall -s
"%LOCALAPPDATA%\Microsoft\Teams\Update.exe" --uninstall --msiUninstall --source=default
)
if exist "C:\Program Files (x86)\Microsoft\Teams\Update.exe" (
"C:\Program Files (x86)\Microsoft\Teams\Update.exe" --uninstall --msiUninstall --source=default
)
:: Delete Teams shortcut
del /q "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Microsoft Teams.lnk" >nul 2>&1
:: Remove registry entries
for %%r in (
"HKEY_CURRENT_USER\Software\Microsoft\Office\Teams"
"HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{00425F68-FFC1-445F-8EDF-EF78B84BA1C7}"
"HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{d1b22d3d-8585-53a6-acb3-0e803c7e8d2a}"
"HKEY_CURRENT_USER\SOFTWARE\Classes\ms-teams"
"HKEY_CURRENT_USER\SOFTWARE\Classes\WOW6432Node\CLSID\{00425F68-FFC1-445F-8EDF-EF78B84BA1C7}"
) do (
reg delete "%%r" /f /reg:64 >nul 2>&1
)
:: Delete Teams directories
if exist "%LOCALAPPDATA%\Microsoft\Teams" (
rd /q /s "%LOCALAPPDATA%\Microsoft\Teams" >nul 2>&1
)
if exist "%APPDATA%\Microsoft\Teams" (
rd /q /s "%APPDATA%\Microsoft\Teams" >nul 2>&1
)
:: Uninstall Teams MSI packages
MsiExec.exe /x{A7AB73A3-CB10-4AA5-9D38-6AEFFBDE4C91} /qn /norestart >nul 2>&1
MsiExec.exe /x{731F6BAA-A986-45A4-8936-7C3AAAAA760B} /qn /norestart >nul 2>&1
:: Remove Teams AppX packages using PowerShell
powershell -Command "Get-AppxPackage -Name MSTeams, MicrosoftTeams | Remove-AppxPackage" >nul 2>&1
:: Optional: Run additional cleanup script
if exist "%setupDir%\Uninstall-Teams.ps1" (
powershell -NoProfile -ExecutionPolicy Bypass -File "%setupDir%\Uninstall-Teams.ps1"
)
timeout /t 10
exit /b 0
Uninstall-Teams.ps1
# MrNetTek # eddiejackson.net # 7/24/2024 # free for public use # free to claim as your own # see https://learn.microsoft.com/en-us/microsoftteams/scripts/powershell-script-deployment-cleanup $ErrorActionPreference = 'Stop' # Define the paths for Teams and its updater executable $TeamsPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'Microsoft\Teams' $TeamsUpdateExePath = Join-Path -Path $TeamsPath -ChildPath 'Update.exe' function Log-Message { param ( [string]$Message ) Write-Host $Message } try { # Check if the Update.exe exists and initiate the uninstall process if (Test-Path -Path $TeamsUpdateExePath) { Log-Message "Uninstalling Microsoft Teams..." # Start the uninstall process and wait for it to complete $proc = Start-Process -FilePath $TeamsUpdateExePath -ArgumentList "-uninstall -s" -NoNewWindow -PassThru $proc.WaitForExit() if ($proc.ExitCode -eq 0) { Log-Message "Microsoft Teams uninstalled successfully." } else { Log-Message "Uninstallation process exited with code $($proc.ExitCode)." } } else { Log-Message "Teams updater executable not found. Teams may not be installed." } # Remove the Teams directory if it exists if (Test-Path -Path $TeamsPath) { Log-Message "Deleting Teams directory..." Remove-Item -Path $TeamsPath -Recurse -Force Log-Message "Teams directory deleted." } else { Log-Message "Teams directory not found." } } catch { Log-Message "An error occurred: $_" exit 1 } exit 0
System Account Script
:: MrNetTek
:: eddiejackson.net
:: 7/24/2024
:: free for public use
:: free to claim as your own
@echo off
:: Uninstall from GUIDs
MsiExec.exe /x{A7AB73A3-CB10-4AA5-9D38-6AEFFBDE4C91} /qn /norestart
MsiExec.exe /x{731F6BAA-A986-45A4-8936-7C3AAAAA760B} /qn /norestart
:: 32
powershell.exe "remove-appxpackage MSTeams_24165.1414.2987.41_x64__8wekyb3d8bbwe"
powershell.exe "remove-appxpackage MicrosoftTeams_24165.1306.2986.9504_x64__8wekyb3d8bbwe"
:: 64
\\%computername%\C$\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "remove-appxpackage MSTeams_24165.1414.2987.41_x64__8wekyb3d8bbwe"
\\%computername%\C$\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "remove-appxpackage MicrosoftTeams_24165.1306.2986.9504_x64__8wekyb3d8bbwe"
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760A}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760B}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760C}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760D}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760E}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760A}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760B}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760C}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760D}" /f /reg:64
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{731F6BAA-A986-45A4-8936-7C3AAAAA760E}" /f /reg:64
timeout /t 5
exit /b 0
Notes
The Windows client is deployed to the AppData folder located in the user’s profile
How the Microsoft Teams MSI package works
Clean up and redeployment procedure
Online Syntax Highlighter | Xt 256
Microsoft Charge with EU Anti-trust for Teams.