Skip to content

Instantly share code, notes, and snippets.

@TimLeitch
Last active June 2, 2022 16:43
Show Gist options
  • Select an option

  • Save TimLeitch/44aa9b898967cf632f20ad78743fd81d to your computer and use it in GitHub Desktop.

Select an option

Save TimLeitch/44aa9b898967cf632f20ad78743fd81d to your computer and use it in GitHub Desktop.
Clear Teams Cache
Write-Host "Closing Teams in order to clear cache"
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 5
Write-Host "Teams is now closed"
}
catch{
echo $_
}
# Now clean temp file locations
try{
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\application cache\cache" -force | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" -recurse -force | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" -recurse -force | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" -force | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" -recurse -force | Remove-Item -recurse -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" -recurse -force | Remove-Item -recurse -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" -recurse -force | Remove-Item -Confirm:$false
}
catch{
echo $_
}
# Teams cache is now cleaned
write-host "Cleaned up Teams Cache"
@TimLeitch
Copy link
Author

Updated script to include -recurse -force and -Confirm:$false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment