scloud by Florian Salzmann
ende

Delete Microsoft Teams Cache once - 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 this 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

Delete Teams Chache manual

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

# 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}

Delete Teams Chache via Intune

I have also written a PowerShell script to delete the Teams cache with Intune once at system start-up. You can simply distribute this via Intune. The script executes the following tasks:

  • At the first run:
    • The script saves itself on the device.
    • Creates a scheduled task that is executed as the system at system start-up.
  • At the second run (via Scheduled Task):
    • Teams Cache will be deleted for all users.
    • Scheduled Task will be deleted.
    • The script deletes itself (so no old scripts on the device)

Script auf GitHub

To distribute the script, you can simply create a new PowerShell script in Intune under “Devices > Windows > PowerShell scripts” 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

Related posts

Intune Autopilot Set Time Zone
Microsoft Intune

Automatically Set the Time Zone in Intune Autopilot

Set the correct time zone during Intune Autopilot using my PowerShell script and IPInfo API. Fast, simple, and no extra services needed.

Custom Compliance Policies in Intune: When and How to Use Them
Intune Starter Series

Custom Compliance Policies in Intune: When and How to Use Them

Use custom compliance in Intune to check services, registry keys, and files. Includes scripts, JSON, and setup tips.

Manage Windows Services with Intune: A Practical Guide
(Proactive) Remediations

Manage Windows Services with Intune: A Practical Guide

Learn how to manage and configure Windows services using Microsoft Intune. I'm using PowerShell and Intune's scripting capabilities.