→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
baritonechimpan
Engaged Sweeper

This script (via Powershell) deletes the roaming profile cache(s) on the target machine. Helpful in a non persistent environment that hasn't used the "Machine Wide Installer".

I used this links as reference:

PowerShell Basics: How to Delete Microsoft Teams Cache for All Users

It wont delete in use files so if a user is logged on using teams it wont delete their files.

You can add a " -WhatIf " statement to the end (see below) and run locally to receive feedback to see what's going to be removed:

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

This script will also be subject to powershell access and application control/restrictions remote execution if its saved as a *.PS1 etc. I've used a *.BAT to run the script or as system account that's isn't restricted

1 REPLY 1
bass
Engaged Sweeper II
baritonechimpanzee wrote:
This script (via Powershell) deletes the roaming profile cache(s) on the target machine. Helpful in a non persistent environment that hasn't used the "Machine Wide Installer".

I used this links as reference:

PowerShell Basics: How to Delete Microsoft Teams Cache for All Users

It wont delete in use files so if a user is logged on using teams it wont delete their files.

You can add a " -WhatIf " statement to the end (see below) and run locally to receive feedback to see what's going to be removed:

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

This script will also be subject to powershell access and application control/restrictions remote execution if its saved as a *.PS1 etc. I've used a *.BAT to run the script or as system account that's isn't restricted


This package is not working for me.

I did it with a file.bat in my shared folder, the bat:

@ECHO OFF
goto:main

[+] Description: Close, clean cache and restart Teams

:main

taskkill /f /t /fi "IMAGENAME eq teams.exe"
echo " Teams Closed!!!!"
del /f /q "%appdata%\Microsoft\teams\application cache\cache\*.*" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\blob_storage\*.*" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\databases\*.*" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\GPUcache\*.*" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\IndexdDB\*.db" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\Local Storage\*.*" > nul 2>&1
del /f /q "%appdata%\Microsoft\teams\tmp\*.*" > nul 2>&1
echo "[+] Cache has been deleted!!!"
C:\Users\%USERNAME%\AppData\Local\Microsoft\Teams\Update.exe --processStart Teams.exe
echo "[+] Teams Started!!!"
echo "DONE"


If someone needs...

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now