Last active
July 12, 2022 19:17
-
-
Save michaelsanford/cda63ba61c3ff420a358da285dc340b4 to your computer and use it in GitHub Desktop.
Prune Microsoft Teams Caches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$teams_active = (Get-Process -Name Teams -ErrorAction SilentlyContinue).length -gt 0 | |
if ($teams_active) { | |
Write-Host "Quitting Teams" | |
Stop-Process -Name Teams | Wait-Process | |
} | |
Set-Location "${env:APPDATA}\Microsoft\Teams" | |
$caches = @("Application Cache\Cache","blob_storage","Cache","databases","GPUcache","IndexedDB","Local Storage","tmp","Cache","backgrounds") | |
foreach ($cache in $caches) { | |
Remove-Item -Force ${cache} -Recurse -ErrorAction SilentlyContinue | |
} | |
Write-Host "Done!" | |
if ($teams_active) { | |
Write-Host "Restarting Teams" | |
Start-Process "$env:APPDATA\..\Local\Microsoft\Teams\Update.exe" -ArgumentList '--processStart','Teams.exe' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment