How to uninstall Teams classic from all users profile

Introduction

With the advent of new technologies and software updates, it becomes crucial to keep our systems up-to-date to ensure security and efficiency. One such update involves the transition from Microsoft Teams Classic to the new Microsoft Teams. This blog will guide you through the process of uninstalling Teams Classic from all user profiles, explain the associated vulnerability, and highlight the importance of this transition.

Understanding the Vulnerability

Qualys Vulnerability Name:

 

Microsoft Teams Heap Buffer Overflow Vulnerability for September 2023

CVE ID: CVE-2023-4863

 

The Microsoft Teams Heap Buffer Overflow Vulnerability (CVE-2023-4863) is a critical security flaw identified in the Teams Classic application. This vulnerability allows attackers to execute arbitrary code on the affected system by exploiting a heap buffer overflow. Essentially, this means that an attacker can manipulate the memory allocation process in Teams Classic, leading to potential data breaches, unauthorized access, and system crashes.

Heap buffer overflow vulnerabilities are particularly dangerous because they can be exploited to gain control over the system, execute malicious code, and compromise sensitive information. Given the widespread use of Microsoft Teams in corporate environments, addressing this vulnerability is of utmost importance to maintain the security and integrity of organizational data.

Why Uninstall Teams Classic from All User Profiles?

Security Concerns: The primary reason for uninstalling Teams Classic is the identified vulnerability (CVE-2023-4863). Leaving this version installed on any user profile poses a significant security risk.

End of Support: Microsoft Teams Classic has reached its end of support. This means that Microsoft will no longer provide security updates, patches, or technical assistance for this version. Continuing to use unsupported software increases the risk of exposure to new vulnerabilities and threats.

Transition to New Teams: Microsoft has rolled out a new version of Teams, which offers enhanced features, improved performance, and better security. The new Teams was launched in October 2022, and it is designed to provide a more seamless and secure collaboration experience.

Compliance and Best Practices: Uninstalling outdated and unsupported software aligns with best practices for IT management and compliance. It ensures that all systems are running the latest, most secure versions of applications.

 

When Did Teams Classic Go Out of Support?

Microsoft Teams Classic officially went out of support on June 30, 2023. From this date onwards, no further updates or support have been provided for this version. Organizations are strongly encouraged to transition to the new Teams to benefit from ongoing support and security enhancements.

Uninstalling Teams Classic: Step-by-Step Guide

To uninstall Teams Classic from all user profiles, you can use the following PowerShell script. This script automates the process of identifying and removing Teams Classic from each user profile on a system.

 

Function Write-HostLog {

    PARAM (

        [Parameter (Mandatory=$true)] $Message,

        $Info=”Information”

    )

    [System.Diagnostics.EventLog]::WriteEntry(“DeleteTeamsClassic”, “$Message”, $Info, 420)

}

 

Function Write-ErrorLog {

    PARAM (

        [Parameter (Mandatory=$true)] $Message,

        $Info=”Error”

    )

    [System.Diagnostics.EventLog]::WriteEntry(“DeleteTeamsClassic”, “$Message”, $Info, 421)

}

 

$profiles = (Get-ChildItem -Path C:\Users).Name

 

Foreach ($prof in $profiles) {

    $TeamsPath = “C:\Users\$prof\AppData\Local\Microsoft\Teams”

    $TeamsUpdateExePath = “$TeamsPath\Update.exe”

    $TeamsRoamingPath = “C:\Users\$prof\AppData\Roaming\Microsoft\Teams”

    $Error.Clear()

 

    if (Test-Path -Path $TeamsPath) {

        Write-HostLog “Uninstalling Teams process under $TeamsPath”

 

        try {

            # Uninstall app

            $proc = Start-Process $TeamsUpdateExePath -ArgumentList “-uninstall -s” -PassThru -ErrorAction Stop

            $proc.WaitForExit()

            Write-HostLog “Successfully uninstalled Classic Teams for profile $prof.”

        }

        catch {

            Write-ErrorLog “Uninstall failed with exception $($_.Exception.Message) for profile $prof.”

        }

 

        Write-HostLog “Deleting Teams directory”

        Remove-Item -Path $TeamsPath -Recurse -Force

 

        Write-HostLog “Deleting Cache Directory for Teams”

        Remove-Item -Path $TeamsRoamingPath -Recurse -Force

    }

    else {

        Write-HostLog “Teams folder not found for $prof profile. Moving to next profile”

    }

}

 

Exit 0

 

Explanation of the Script

 

Logging Functions: The script includes two functions, Write-HostLog and Write-ErrorLog, to log information and errors to the Windows Event Log. This helps in tracking the uninstallation process and identifying any issues that may arise.


Profile Enumeration: The script retrieves the list of user profiles on the system using Get-ChildItem -Path C:\Users. This ensures that the uninstallation process is applied to all user profiles.


Uninstallation Process: For each user profile, the script checks if the Teams Classic directory exists. If it does, the script attempts to uninstall Teams Classic using the Update.exe executable with the -uninstall -s arguments. It then deletes the Teams Classic directory and its cache directory to ensure complete removal.


Error Handling: The script includes error handling to log any exceptions that occur during the uninstallation process. This helps in troubleshooting and ensuring that the process completes successfully.

Leave a Comment

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

Scroll to Top