Skip to content

Instantly share code, notes, and snippets.

@michaelsanford
Last active July 12, 2022 19:17
Show Gist options
  • Save michaelsanford/cda63ba61c3ff420a358da285dc340b4 to your computer and use it in GitHub Desktop.
Save michaelsanford/cda63ba61c3ff420a358da285dc340b4 to your computer and use it in GitHub Desktop.
Prune Microsoft Teams Caches
$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