diff --git a/Fix-MicrosoftTeams.ps1 b/Fix-MicrosoftTeams.ps1 index 8543dd3..d9c724f 100644 --- a/Fix-MicrosoftTeams.ps1 +++ b/Fix-MicrosoftTeams.ps1 @@ -1 +1,25 @@ -End-Process -Name "Teams" -Match -Force \ No newline at end of file +. 'C:\Users\dyoder\Emberkom\Data\Projects\development\management-scripts\Tools.ps1' +## Stop all instances of Teams +End-Process -Name "Teams" -Match -Force + +If ( $Reinstall ) { + + ## Uninstall Teams for current user + $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}" } + + ## Remove all cached content + $CacheDir = "${Env:LOCALAPPDATA}\Microsoft\Teams" + If ( Test-Path $CacheDir ) { + LogMsg "Removing all cached data for Teams" + 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 + +} \ No newline at end of file