Auto delete MS Teams data

Modified on Thu, 14 Jan, 2021 at 12:13 PM

Users frequently run out of disk space on their N: drives, the usual result is that they cannot run MS Teams.


The batch file below, is configured to run under the following policies; Staff and Staff Macros Enabled 


@echo off

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\blob_storage\*"

FOR /D %%p IN ("\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\blob_storage\*") DO rmdir "%%p" /s /q

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\Cache\*"

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\databases\*"

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\gpucache\*"

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\IndexedDB\*"

FOR /D %%p IN ("\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\IndexedDB\*") DO rmdir "%%p" /s /q

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\Local Storage\*"

FOR /D %%p IN ("\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\Local Storage\*") DO rmdir "%%p" /s /q

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\tmp\*"

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\backgrounds\*"

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\Teams\Service Worker\CacheStorage\*"



rem *** Deletes temporary Powerpoint files ****


@echo off

del /F/Q/S "\\gfs-svr-003\%Username%$\My Settings\Application Data\Microsoft\PowerPoint\*"


See RMMC


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article