Last active
June 2, 2022 16:43
-
-
Save TimLeitch/44aa9b898967cf632f20ad78743fd81d to your computer and use it in GitHub Desktop.
Clear Teams Cache
This file contains hidden or 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
| 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" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated script to include -recurse -force and -Confirm:$false