major change to override Write-Error func

This commit is contained in:
2023-10-05 13:17:18 -04:00
parent bbb4884818
commit 5f4b4565de
42 changed files with 114 additions and 114 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ If ( Test-Path "${Env:LocalAppData}\Microsoft\Teams\Update.exe" ) {
If ( $ProcessList ) {
Write-Output "Stopping Microsoft Teams"
Try { $ProcessStopped = $true ; $ProcessList | Stop-Process -Force }
Catch { LogErr $_.Exception.Message }
Catch { Write-Error $_.Exception.Message }
} Else { $ProcessStopped = $false }
# Remove all cached content
@@ -15,13 +15,13 @@ If ( Test-Path "${Env:LocalAppData}\Microsoft\Teams\Update.exe" ) {
If ( Test-Path $CacheDir ) {
Write-Output "Removing all cached data for Microsoft Teams"
Try { Remove-Item $CacheDir -Recurse -Force }
Catch { LogErr $_.Exception.Message }
Catch { Write-Error $_.Exception.Message }
} Else { Write-Output "Could not clear cached data for Microsoft Teams because the directory could not be found: ${CacheDir}" }
# Restart Teams if we needed to close it before clearing the cache
If ( $ProcessStopped ) {
Write-Output "Starting Microsoft Teams"
Try { Start-Process "${Env:LocalAppData}\Microsoft\Teams\Update.exe" -ArgumentList "--processStart ""Teams.exe""" }
Catch { LogErr $_.Exception.Message }
Catch { Write-Error $_.Exception.Message }
}
} Else { Write-Output "Cannot clear cache for Microsoft Teams because it isn't installed" }