Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Uninstall, Reinstall, and Cleanup Microsoft Teams App (Classic)

August 13, 2024
in A, Blog, Microsoft Teams, Powershell
0
ADVERTISEMENT

Table of Contents

Uninstall, Reinstall, and Cleanup Microsoft Teams App (Classic)

Uninstalling, reinstalling, and cleaning up the Microsoft Teams app classic can help resolve issues related to the application and ensure that you have a fresh installation.

zpzSP4eBILnY2FyRbKdzLrKfKpfe1p1cVkuklQa7qVZqROXMqC7gbMZkAhml

You have the option to perform this task either manually from Windows Settings or Control Panel. However, in this post, we will utilize a PowerShell script to automate the process.

Here is a summary of the steps from the PowerShell script to uninstall Microsoft Teams:

  1. Prompt for Cache Clearing: Asks if the user wants to delete the Teams cache.
  2. Stop Teams Process: Stops any running Teams processes.
  3. Clear Cache: Removes various Teams-related cache directories.
  4. Uninstall Teams: If selected, it uninstalls all Microsoft Teams applications, including the machine-wide installer, Classic, and new versions of Teams using Windows Package Manager.
# Clearing Teams Cache and Uninstall Teams
    $clearCache = Read-Host "Do you want to delete the Teams Cache (Y/N)?"
    $clearCache = $clearCache.ToUpper()

    $uninstall= Read-Host "Do you want to uninstall Teams completely (Y/N)?"
    $uninstall= $uninstall.ToUpper()

# Clear Microsoft Teams cache
    if ($clearCache -eq "Y"){
        Write-Host "Stopping Teams Process" -ForegroundColor Yellow

        try{
            Get-Process | where {$_.ProcessName -like '*teams*'} | Stop-Process -Force -ErrorAction SilentlyContinue
            Start-Sleep -Seconds 3
            Write-Host "Teams Process Sucessfully Stopped" -ForegroundColor Green
        }
        catch{
            Write-Output $_
        }
        
        Write-Host "Clearing Teams Disk Cache" -ForegroundColor Yellow

        try{
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\application cache\cache" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" -Recurse -ErrorAction SilentlyContinue| Remove-Item -Confirm:$false -Recurse
            Write-Host "Teams Disk Cache Cleaned" -ForegroundColor Green
        }
        catch{
            Write-Output $_
        }
    }

# Uninstall all Microsoft Teams apps
    if ($uninstall -eq "Y"){

        # Removing Teams Machine-wide
        Write-Host "Removing Teams Machine-wide Installer" -ForegroundColor Yellow
        $MachineWide = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Teams Machine-Wide Installer"}
        $MachineWide.Uninstall()

        # Remove Teams App (Classic)
        function unInstallTeams($path) {
            $clientInstaller = "$($path)\Update.exe"
            try {
                $process = Start-Process -FilePath "$clientInstaller" -ArgumentList "--uninstall /s" -PassThru -Wait -ErrorAction STOP
                if ($process.ExitCode -ne 0) {
                    Write-Error "UnInstallation failed with exit code  $($process.ExitCode)."
                }
            }
            catch {
                Write-Error $_.Exception.Message
            }
        }
        
        #Locate installation folder
        $localAppData = "$($env:LOCALAPPDATA)\Microsoft\Teams"
        $programData = "$($env:ProgramData)\$($env:USERNAME)\Microsoft\Teams"
        
        If (Test-Path "$($localAppData)\Current\Teams.exe") {
            unInstallTeams($localAppData)
        } elseif (Test-Path "$($programData)\Current\Teams.exe") {
            unInstallTeams($programData)
        } else {
            Write-Warning  "Teams installation not found"
        }

        # Update Windows Package Manager then remove Teams free and Teams app (New)
        $winget = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq 'Microsoft.DesktopAppInstaller'}
        If ([Version]$winGet.Version -lt "2022.506.16.0") {
            Write-Host "Updating Windows Package Manager..." -ForegroundColor Yellow
            Invoke-RestMethod bonguides.com/winget | Invoke-Expression
        }

        $path = "C:\Program Files\WindowsApps"
        $winget = Get-ChildItem $path -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "WinGet.exe" } | Select-Object -ExpandProperty fullname -ErrorAction SilentlyContinue

        If ($winget.count -gt 1){ $winget = $winget[-1] }

        Write-Host "Removing Teams apps..." -ForegroundColor Yellow
        & $winget uninstall Microsoft.Teams --exact --silent --force --accept-source-agreements
        & $winget uninstall MicrosoftTeams_8wekyb3d8bbwe --exact --silent --force --accept-source-agreements
    }

How to run the script

Method 1: You can copy the code, create a PowerShell script, and then run it manually on your computer.

Method 2: Execute the script directly:

1. Right-click on the Windows Start icon then open PowerShell (Terminal) as administrator.

zpzSP4eBILnY2FyRbKdzLrKfKpfe1p1cVkuklQa7qVZqROXMqC7gbMZkAhml

2. Run the following command to execute the script directly without having to create it manually.

Note Note: The PowerShell script is safe, but you should verify the security and contents of any script from the internet you are not familiar with.
irm bonguides.com/teams/uninstall | iex
#Output
Do you want to delete the Teams Cache (Y/N)?: y
Do you want to uninstall Teams completely (Y/N)?: y
Stopping Teams Process
Teams Process Sucessfully Stopped
Clearing Teams Disk Cache
Teams Disk Cache Cleaned
Removing Teams Machine-wide Installer
WARNING: Teams installation not found
Removing Teams apps...
Found Microsoft Teams [Microsoft.Teams]
Starting package uninstall...
  ██████████████████████████████  100%
Successfully uninstalled
Found Microsoft Teams (personal) [Microsoft.Teams.Free]
Starting package uninstall...
  ██████████████████████████████  100%
Successfully uninstalled
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

3.5/5 - (2 votes)
Previous Post

How to Disable or Exit the Focus Mode in Windows Terminal

Next Post

How to Enable Microsoft Store in Windows Sandbox

Related Posts

Images Hidden Due To Mature Content Settings In CivitAI

August 31, 2024

Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

August 20, 2024

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024

How to Remove The Test Mode Watermark Without Disabling Test Mode

July 28, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory