I wrote a script to totally remove MS Teams and then re-install for user using generic installation file that I uploaded to my environment:
[I’m sure it can be written better]
//Clear the environment
delete __appendfile
if {exist file “c:\TEMP\teamsu.bat”}
delete c:\TEMP\teamsu.bat
endif
if {exist file “c:\TEMP\teamsr.bat”}
delete c:\TEMP\teamsr.bat
endif
//Uninstall Teams
appendfile taskkill /IM teams.exe /F
appendfile {"%22"&concatenation “%22 --uninstall%0d%0a%22” of (pathnames of files “Update.exe” of folders “AppData\Local\Microsoft\Teams” of folders of folders “C:\Users”)&"%22 --uninstall"}
move __appendfile c:\TEMP\teamsu.bat
if {exist file “c:\TEMP\teamsu.bat”}
waithidden c:\TEMP\teamsu.bat
endif
//clean appendfile
delete __appendfile
//Delete leftovers from all users appdata
appendfile ## del leftovers ##
if {exist (pathname of it) of folders whose (name of it as lowercase contains “teams”) of folders of folders “AppData” of folders of folders “C:\Users”}
appendfile {“RD /S /Q %22” & concatenation “%22%0d%0aRD /S /Q %22” of ((pathname of it) of folders whose (name of it as lowercase contains “teams”) of folders of folders “AppData” of folders of folders “C:\Users”)& “%22”}
endif
if {exist (pathname of it) of folders whose (name of it as lowercase contains “teams”) of folders of folders of folders “AppData” of folders of folders “C:\Users”}
appendfile {“RD /S /Q %22” & concatenation “%22%0d%0aRD /S /Q %22” of ((pathname of it) of folders whose (name of it as lowercase contains “teams”) of folders of folders of folders “AppData” of folders of folders “C:\Users”)& “%22”}
endif
move __appendfile c:\TEMP\teamsr.bat
if {exist file “c:\TEMP\teamsr.bat”}
waithidden c:\TEMP\teamsr.bat
endif
//Clear the environment
delete __appendfile
if {exist file “c:\TEMP\teamsu.bat”}
delete c:\TEMP\teamsu.bat
endif
if {exist file “c:\TEMP\teamsr.bat”}
delete c:\TEMP\teamsr.bat
endif
prefetch //your setup upload// extract to c:\TEMP
override wait
Hidden=true
RunAs=currentuser
wait c:\TEMP\TeamsSetup_c_w_.exe