Files
management-scripts/Fix-MicrosoftTeams.ps1
T

24 lines
902 B
PowerShell
Raw Normal View History

2021-09-30 08:14:30 -04:00
## Stop all instances of Teams
2021-09-30 08:11:57 -04:00
End-Process -Name "Teams" -Match -Force
If ( $Reinstall ) {
## Uninstall Teams for current user
2022-03-17 14:22:49 -04:00
# $Uninstaller = "${Env:LOCALAPPDATA}\Microsoft\Teams\Update.exe"
# If ( Test-Path $Uninstaller ) {
# LogMsg "Uninstalling Teams for ${Env:USERNAME}"
# Try { Start-Process $Uninstaller -ArgumentList "--uninstall" -Wait }
# Catch { LogErr $_.Exception.Message }
# } Else { LogMsg "Teams could not be uninstalled for ${Env:USERNAME}" }
2021-09-30 08:11:57 -04:00
## Remove all cached content
$CacheDir = "${Env:LOCALAPPDATA}\Microsoft\Teams"
If ( Test-Path $CacheDir ) {
2021-09-30 08:29:14 -04:00
LogMsg "Removing all cached data"
2021-09-30 08:11:57 -04:00
Try { Remove-Item $CacheDir -Recurse -Force }
Catch { LogErr $_.Exception.Message }
} Else { LogMsg "Could not clear cached data because the directory could not be found" }
## ToDo: Reinstall Teams
2021-09-30 08:29:14 -04:00
}