Skip to content
Home » Clear Microsoft Teams cache once - Intune

Clear Microsoft Teams cache once - Intune

Delete Team Cache with Intune

In the past two weeks, I had the problem with some customers that teams got stuck in a «boot loop». The user only saw "Microsoft Teams loading...".
You can easily solve the problem by cleaning the teams cache. To delete the teams cache centrally for all users, I wrote a PowerShell script that can be distributed with Intune.

This is what the boot loop looks like, an error is not displayed even after waiting 20 minutes:

teams

Clear teams cache manually

You can manually delete the teams cache with a one-liner in PowerShell on the device for the current user and with admin rights for all users on the device.

# All Users Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Teams\*" -directory | Where name -in ('application cache','blob storage','databases','GPUcache','IndexedDB','Local Storage','tmp') | ForEach{Remove-Item $_.FullName -Recurse -Force } # Current User Stop-Process -Name Teams; Get-ChildItem -Path "$env:USERPROFILE\AppData\Roaming\Microsoft\Teams" -Directory | Where{$_ -in ('Cache','databases','blob_storage','IndexedDB','GPUCache','Local Storage','tmp','')} | ForEach{Remove-Item $_.FullName -Recurse -Force}
Code language: PowerShell (powershell)

Clear teams cache via Intune

I also wrote a PowerShell script to delete the teams cache with Intune once at system start. You can simply distribute this via Intune. This causes the script to perform the following tasks:

  • On the first run:
    • The script saves itself on the device.
    • Creates a scheduled task that runs as system at startup.
  • For the second execution (via Scheduled Task):
    • The Teams cache will be cleared for all users.
    • The scheduled task created is deleted.
    • The script itself on the device is deleted.

To distribute the script, you can simply use the Endpoint Manager under «Devices > Windows > PowerShell scripts» create a new PowerShell script as a system in the 64-bit context and assign it to the desired group.

PowerShell script Intune, title and description
run as system in 64bit context

Leave a Reply

Your email address will not be published.