Home > database >  Teams computer wide install
Teams computer wide install

Time:01-28

I'm trying to create a script to populate the existing users folders on a Windows workstation and then do a 'for each' to: remove the directories c:\users\%username%\appdata\roaming\Microsoft\teams and also c:\users\%username%\appdata\local\Microsoft\teams in order to completely gut the system of any left over Teams installs.

I already have the script to install computer-wide Teams, plus a PowerShell script to initiate a Teams install for the user as a scheduled task that triggers immediately, (although teams won't work until a reboot for some reason), but I digress.

Currently I only have the removal script for the logged on user, (although it says it cant find the file), but I know this can be done for all users.

ECHO Ensure you are running this while logged on to the account of the user that has issues
ECHO Changing to users AppData folder
CD "%AppData%"
ECHO Removing corrupted Teams Files from User account
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\blob_storage\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\cache\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\databases\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\gpucache\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\indexeddb\*.*"
DEL /S /Q /F "%appdata%\roaming\microsoft\teams\Local Storage\*.*"
DEL /S /Q /F  "%appdata%\roaming\microsoft\teams\tmp\*.*"
PAUSE

CodePudding user response:

You can use the "for" loop in Windows command prompt (cmd.exe) to iterate through all the user folders in the "c:\users" directory, and then use the "rd" command (short for "remove directory") to delete the specified folders.

For example, the script could look like this:

for /d %i in (c:\users\*) do (
    rd /s /q "c:\users\%i\appdata\roaming\Microsoft\teams"
    rd /s /q "c:\users\%i\appdata\local\Microsoft\teams"
)

The /s switch is used to remove all subfolders and files. /q switch is used to delete files without a prompt confirmation.

Please be aware that, this will delete all files and folders inside the specified directory, including all subdirectories and files, so please be sure you are using the correct directory path before running the script.

remember to have a backup of the entire system before making any changes.

CodePudding user response:

Teams machine wide install:

:: install.bat
:: https://www.reddit.com/r/sysadmin/comments/hzektt/comment/fzje31l/?utm_source=reddit&utm_medium=web2x&context=3
:: machine wide install, ends up being 32-bit

reg add HKLM\SOFTWARE\Citrix\PortICA /f 
start /wait msiexec /i Teams_windows_x64.msi /qb ALLUSER=1
set err=%errorlevel%

del "c:\users\public\desktop\Microsoft Teams.lnk"

reg delete hklm\software\wow6432node\microsoft\windows\currentversion\run /f /v teams

exit /b %err%
  • Related