31 lines
1.1 KiB
PowerShell
31 lines
1.1 KiB
PowerShell
<#
|
|
From https://www.reddit.com/r/sysadmin/comments/aq72e4/microsoft_teams_wont_stay_uninstalled/
|
|
.SYNOPSIS
|
|
This script allows you to uninstall the Microsoft Teams app and remove Teams directory for a user.
|
|
.DESCRIPTION
|
|
Use this script to clear the installed Microsoft Teams application. Run this PowerShell script for each user profile for which the Teams App was installed on a machine. After the PowerShell has executed on all user profiles, Teams can be redeployed.
|
|
#>
|
|
|
|
$TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams')
|
|
$TeamsUpdateExePath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams', 'Update.exe')
|
|
|
|
try
|
|
{
|
|
if (Test-Path -Path $TeamsUpdateExePath) {
|
|
Write-Host "Uninstalling Teams process"
|
|
|
|
# Uninstall app
|
|
$proc = Start-Process -FilePath $TeamsUpdateExePath -ArgumentList "-uninstall -s" -PassThru
|
|
$proc.WaitForExit()
|
|
}
|
|
if (Test-Path -Path $TeamsPath) {
|
|
Write-Host "Deleting Teams directory"
|
|
Remove-Item -Path $TeamsPath -Recurse
|
|
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
Write-Error -ErrorRecord $_
|
|
exit /b 1
|
|
} |