
You upgraded to Microsoft Teams 2.0. Great. The only issue is the new Team’s hangs on login. Clearing the Teams cache will do the trick. You know how to clear the cache for one user but what if the machine in question is logged into by several users? Manually deleting dozens if not hundreds of profiles could take a very long time. How do you go about Clearing Teams Cache on Multiple Profiles.
If you follow the tips in this article, you will have it done in No Time.
Prerequisites
The following needs to occur when Clearing Teams Cache on Multiple Profiles:
- Be an Admin on domain (obviously 😊).
- Run PowerShell on Domain where the computer(s) reside.
- The WinRM services needs to be running when the cache is cleared.
- Use the invoke command to run the PS command on the remote machine.
- For security purposes, stop the WinRM service when done.
Location For Clearing Teams Cache on Multiple Profiles
Microsoft Teams 2.0 has a new local for its cache. It is C:\Users\<UserName>\AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\ . This is the location you need to work into your PowerShell command. If are still using Teams Classic Use C:\Users<UserName>\AppData\Local\Microsoft\Teams* to work into your PowerShell command.
Constructing The PowerShell Command
The command is constructed like this for Clearing Teams Cache on Multiple Profiles:
Get-Service -ComputerName <ComputerName> -Name WinRM | Start-Service
Invoke-Command -ComputerName <ComputerName> -ScriptBlock { Remove-Item "C:\Users\*\AppData\Local\Packages\MSTeams_8wekyb3d8bbwe\*" -Force} -credential <yourusername>
Get-Service -ComputerName <ComputerName> -Name WinRM | Stop-Service -Force
Running this command remote will remove the teams’ files from every user profile on the computer. If you want to make sure the command works before you pull the trigger, you can add the -whatif switch to the end of the Remove-Item command (before the quote).
If you have more than one machine to work on you can run a for each loop with a variable for <ComputerName> that reads the variable from a CSV file. This is a lot faster
