Home » Microsoft Teams » Clear the Microsoft Teams Client Cache

Clear the Microsoft Teams Client Cache

Microsoft Teams cache behaviour is a lot to be desired if I am honest. One thing for sure is that if you are deploying Teams you’ll quickly find that your admin controlled policy settings take a random amount of time to come into effect on the target machines.

Unlike Skype for Business Online where in-band policy changes took longest 30 minutes, with Teams we can be waiting days, and I mean that literally.

Upon talking with support the standard response is that it can take anything from 30 minutes to 3 days for policies to become effective. To me, this is unacceptable and Microsoft have acknowledged that at least. Hopefully we will see some improvements soon.

The problem though really centers around the client cache. So clearing the cache is the first step to troubleshooting. The trouble is, the cache for Teams isn’t in one place or even a single directory. It’s split in multiple directories and even Internet Explorer and Chrome cache locations. So when support as you to clear the cache, there are something like 13 different places you need to go in order to clean the machine.

These locations are:

  • %AppData%\Microsoft\teams\application cache\cache
  • %AppData%\Microsoft\teams\blob_storage
  • %AppData%\Microsoft\teams\databases
  • %AppData%\Microsoft\teams\cache
  • %AppData%\Microsoft\teams\gpucache
  • %AppData%\Microsoft\teams\Indexeddb
  • %AppData%\Microsoft\teams\Local Storage
  • %AppData%\Microsoft\teams\tmp
  • %LocalAppData%\Google\Chrome\User Data\Default\Cache
  • %LocalAppData%\Google\Chrome\User Data\Default\Cookies
  • %LocalAppData%\Google\Chrome\User Data\Default\Web Data
  • Internet Explorer Temporary Internet Files
  • Internet Explorer Cookies

Only after clearing these locations is it considered a clean start for the Teams app. Through pain of trial I have now given up and made a PowerShell script to do this for me, shared below.

$challenge = Read-Host "Are you sure you want to delete Teams Cache (Y/N)?"
$challenge = $challenge.ToUpper()
if ($challenge -eq "N"){
Stop-Process -Id $PID
}elseif ($challenge -eq "Y"){
Write-Host "Stopping Teams Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Teams Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Teams Disk Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\application cache\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" | Remove-Item -Confirm:$false
Write-Host "Teams Disk Cache Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping Chrome Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Chrome| Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Chrome Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Chrome Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cookies" -File | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Web Data" -File | Remove-Item -Confirm:$false
Write-Host "Chrome Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping IE Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName MicrosoftEdge | Stop-Process -Force
Get-Process -ProcessName IExplore | Stop-Process -Force
Write-Host "Internet Explorer and Edge Processes Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing IE Cache" -ForegroundColor Yellow
try{
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 2
Write-Host "IE and Edge Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Cleanup Complete... Launching Teams" -ForegroundColor Green
Start-Process -FilePath $env:LOCALAPPDATA\Microsoft\Teams\current\Teams.exe
Stop-Process -Id $PID
}else{
Stop-Process -Id $PID
}

26 Comments

  1. Hi Mark,

    Great article and thanks for sharing the script, its a pain having to filter through all the folders to remove the cache files. I have a similar ongoing support ticked open with MS right now on exactly this issue.

    They asked me to clear the cache from this folder also “meeting-addin” however this requires outlook to be closed before it allows you to delete it.

    cheers

    laurence

  2. Good stuff, thanks. Your script solved a display issue one of our users had within one specific channel, that prevented them from adding new content. Well done!

  3. Thank you – really helpful! Is it possible to “one-click automate” this script in a simple way for a noob like me? Would be fantastic to have a “clear Teams cache” icon on the desktop until they have solved the issue?

    • You’d need to firsty make a registry entry to enable clicking to execute PS Scripts from shortcuts. Change this: \HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command to “C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe” “%1”

  4. Tx for the script, was helpful in troubleshooting my Teams issue. Didn’t solve it unfortunately. Removed guest accounts remain cached in Teams, despite the fact that they are hard-deleted from Azure. Re-adding them results in an error. Annoying. (the guest accounts have migrated to another tenant but kept their UPN)

  5. sorry not enough, there must be more than this. If you will check -> use the script + try to login with the user account befor. You will see no password ask. Damn MS ….

  6. I have several organizations/accounts that I am a guest of in Teams, and on one of those accounts, on my iPhone app, it persistently shows that I have 2 notifications. But when I go into that account, there is nothing. I have tried everything I can think of. Any ideas?

  7. I did all that but we still have a problem. Our teams tries a SSO with our PC login and that always fails as its not the login we use for Teams. After a couple days it will let us login again but between then and now…

  8. Looks like M$. Why not having thousands of different cache locations?
    Don’t let the dumb users understand what’s happening in Windows!
    Keep it strange and complicated!

    And after all:
    Give them a Powershell Script to fix the damn thing!
    But never ever execute Powershell Scripts using double click, because it’s too dangerous!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: