Skip to content
PowerShell Script

PowerShell Script – Clear Microsoft Teams Cache

When your Microsoft Teams application is behaving strange or have issues, one of the first steps in troubleshooting is to clear the cache. You can do this manually or using a script

If you check Clear Teams cache Microsoft Learn (at present time), they recommend you delete the whole App folder. This will also delete your custom backgrounds, the script let you choose which folders to remove.

To see the folders you delete; open the Run dialog (Win+R). Enter %appdata%\Microsoft\Teams, and click OK. The script has an array to choose which folder to delete, you can change the array to fit your needs.

Check my repo on GitHub, to get the latest updates in case I create some new options or change the standard folders. Use this script to learn more

5 thoughts on “PowerShell Script – Clear Microsoft Teams Cache”

  1. Hi, I get an error message when I run your script:

    Do you want to delete the Teams Cache (Y/N)?: y
    Stopping Teams Process
    Get-Process : Cannot find a process with the name “Teams”. Verify the process name and call the cmdlet again.
    At line:43 char:13
    + Get-Process -ProcessName Teams | Stop-Process -Force
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Teams:String) [Get-Process], ProcessCommandException
    + FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand

    Teams Process Sucessfully Stopped
    Clearing Teams Disk Cache
    Cleanup Complete… Launching Teams
    Start-Process : This command cannot be run due to the error: Systemet finner ikke angitt fil.
    At line:73 char:9
    + Start-Process -File “$($env:USERProfile)\AppData\Local\Micros …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

  2. ty

    think ill use but need it to delete the whole teams folder which is what we do at our company

    but the restart doesnt work. we dont have an update file after

  3. This is interesting! It automatically closes and opens the teams application after clearing the cache. This is quite impressive!

    1. Indeed, this line does so
      Get-Process -ProcessName Teams | Stop-Process -Force
      The Get-Process finds the process with the name “Teams” pipes it to the Stop-Process command.
      Start-Process -File "$($env:USERProfile)\AppData\Local\Microsoft\Teams\Update.exe" -ArgumentList '--processStart "Teams.exe"'
      Here it starts the Process again.

Leave a Reply

Your email address will not be published. Required fields are marked *

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