major update to override Write-Output func
This commit is contained in:
@@ -5,7 +5,7 @@ If ( Test-Path "${Env:LocalAppData}\Microsoft\Teams\Update.exe" ) {
|
||||
$ProcessList = (Get-Process -Name 'teams' -ErrorAction SilentlyContinue)
|
||||
|
||||
If ( $ProcessList ) {
|
||||
LogMsg "Stopping Microsoft Teams"
|
||||
Write-Output "Stopping Microsoft Teams"
|
||||
Try { $ProcessStopped = $true ; $ProcessList | Stop-Process -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
} Else { $ProcessStopped = $false }
|
||||
@@ -13,15 +13,15 @@ If ( Test-Path "${Env:LocalAppData}\Microsoft\Teams\Update.exe" ) {
|
||||
# Remove all cached content
|
||||
$CacheDir = "${Env:AppData}\Microsoft\Teams"
|
||||
If ( Test-Path $CacheDir ) {
|
||||
LogMsg "Removing all cached data for Microsoft Teams"
|
||||
Write-Output "Removing all cached data for Microsoft Teams"
|
||||
Try { Remove-Item $CacheDir -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
} Else { LogMsg "Could not clear cached data for Microsoft Teams because the directory could not be found: ${CacheDir}" }
|
||||
} 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 ) {
|
||||
LogMsg "Starting Microsoft Teams"
|
||||
Write-Output "Starting Microsoft Teams"
|
||||
Try { Start-Process "${Env:LocalAppData}\Microsoft\Teams\Update.exe" -ArgumentList "--processStart ""Teams.exe""" }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
} Else { LogMsg "Cannot clear cache for Microsoft Teams because it isn't installed" }
|
||||
} Else { Write-Output "Cannot clear cache for Microsoft Teams because it isn't installed" }
|
||||
|
||||
Reference in New Issue
Block a user