Skip to content
Menu

Teams Won't Load - Clear the Teams Cache

Clears the new and classic Teams cache folders in every user profile, or only the users you name. Users with Teams open are skipped unless CloseTeams is on.

Teams won't load - clear the Teams cache is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Teams won't load - clear the Teams cache. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM
NeedsPowerShell 5.1, administrator rights
Changes thingsChanges what it runs on

What It Does

For each selected profile in the system drive's Users folder, the script deletes the contents of the Teams cache folders: the Microsoft\MSTeams subfolder of LocalCache for new Teams, and the Cache, GPUCache, IndexedDB, Local Storage, blob_storage, databases, tmp, Code Cache and service worker cache folders of classic Teams.

It never deletes the whole Teams folder or anything else in the profile, so classic Teams keeps its settings and custom backgrounds. Teams rebuilds the cache the next time the user opens it, and may ask them to sign in again.

If Teams is running for a user, that user is skipped and the row says so. With CloseTeams set to true the script stops that user's Teams first, and the user loses any message they had not sent. If the script cannot tell whether Teams is running for a user, it treats it as running and skips them, even with CloseTeams. It never starts Teams again.

Before You Run It

  • Tell the user they may need to sign in to Teams again afterwards.
  • Run it without CloseTeams first. Turn CloseTeams on only when the user has agreed to lose anything unsent.
  • On a shared or terminal server PC, name the users you mean in Users rather than clearing every profile.

When to Clear the Teams Cache

Try this when the Windows desktop client opens to a blank window or gets stuck loading for one user, and the same work account opens Teams in a browser. Have the user fully quit and reopen Teams first. If that clears the symptom, stop there.

If the web app also fails or other users have the same problem, check Microsoft 365 service health and investigate shared sign-in or connectivity first. For missing messages, missing channels, or incorrect notifications, collect diagnostic logs and investigate the original symptom. A cache clear can remove logs Microsoft needs.

Worked Ticket: One Blank Teams Window

Fictional ticket HD-2416. On WIN-27, Alex can use Teams on the web, but new Teams on Windows still opens blank after a normal restart. Alex saves any unsent work and selects Quit from the Teams tray icon. From an elevated Windows PowerShell 5.1 session or the RMM running as SYSTEM, set Users=alex, CloseTeams=false, DryRun=true and OutputFormat=Text. Leave ExportPath and ResultField unset.

With a readable profile owner, Teams closed, and 12 new Teams cache files totalling 8 MiB, the preview row shows alex (New Teams), Delete 12 cache file(s), 8.0 MB, and Would change. The final line is:

RESULT: DRYRUN | Dry run, nothing changed. Would have: Cleared Teams cache for 1 user(s), 8.0 MB

Proceed with DryRun=false for the same profile only after confirming the row and the user’s timing. If Teams is still running, ask the user to quit and preview again. If the owner could not be read, confirm the account and process ownership first. With no actionable profiles, this version returns ERROR. An empty cache or no cache found gives you nothing to clear.

Verify the Fix

After CHANGED, have Alex open the desktop app, sign in if prompted, and repeat the action that failed. Confirm Teams reaches the workspace and can open the intended channel or meeting. Allow time for the cache to rebuild. If the same blank window returns, record the Teams version, exact symptom and timestamp, collect fresh logs, and move to launch troubleshooting.

Microsoft References

Clear the Teams client cache

Resolve issues when starting the new Teams app

Type and Risk

  • Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
  • Risk: Low. Set DryRun=true, or run it with -WhatIf, to list every change without making any.
  • What it changes: Deletes the cache folders of new and classic Teams in each user profile; with CloseTeams, stops that user's Teams processes.
  • Restart: It never restarts the machine.
  • Typical run: Under 1 minute.
  • Example answer: "Cleared Teams cache for 3 user(s), 412.6 MB"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • Users: Only these users (profile folder names or account names, separated by commas or semicolons). Default empty: every profile.
  • CloseTeams: true to stop a user's running Teams before clearing their cache. Default false: a user whose Teams is running is skipped.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

clear-teams-cache.ps1 · 977 lines · 49.9 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.