简体   繁体   English

Teams 计算机范围安装

[英]Teams computer wide install

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.我正在尝试创建一个脚本来填充 Windows 工作站上的现有用户文件夹,然后“针对每个”执行以下操作:删除目录c:\users\%username%\appdata\roaming\Microsoft\teams以及c:\users\%username%\appdata\local\Microsoft\teams以便完全清除系统中任何剩余的 Teams 安装。

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.我已经有了安装计算机范围 Teams 的脚本,加上一个 PowerShell 脚本来为用户启动 Teams 安装作为立即触发的计划任务,(尽管由于某种原因团队在重新启动之前不会工作),但我离题了.

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

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.您可以在 Windows 命令提示符 (cmd.exe) 中使用“for”循环遍历“c:\users”目录中的所有用户文件夹,然后使用“rd”命令(“删除目录”的缩写)删除指定的文件夹。

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. /s 开关用于删除所有子文件夹和文件。 /q switch is used to delete files without a prompt confirmation. /q 开关用于在没有提示确认的情况下删除文件。

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.请记住在进行任何更改之前备份整个系统。

Teams machine wide install: Teams 机器范围安装:

:: 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%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM