[玩转系统] Microsoft Teams 卸载、重新安装和清理指南和脚本
作者:精品下载站 日期:2024-12-14 03:40:11 浏览:16 分类:玩电脑
Microsoft Teams 卸载、重新安装和清理指南和脚本
在安装和卸载方面,Microsoft Teams 与普通程序不同。 Microsoft Teams 的问题在于它是为每个用户安装的,位于用户的 AppData(有时是程序数据)中。除此之外,我们还有 Microsoft Teams 机器范围的安装程序,当用户登录时,它将自动安装 Teams。
使用 Microsoft Teams 清理问题可能非常具有挑战性。例如,我最近尝试为用户删除并重新安装 Teams。用户收到错误:每次更新 Microsoft Teams 时 Microsoft Teams 安装均失败
删除所有内容并重新安装 Teams 后,他最终得到了一个空白的 Teams 应用程序。因此,没有聊天历史记录,也没有更多的 Teams 频道(即使在线一切仍然可见)。
在本文中,我将向您提供一些删除和清理 Teams 的提示和脚本,以便您可以再次重新安装它。
利用这些有趣的 Microsoft Teams 背景让 Teams 变得更有趣
修复 Microsoft Teams 安装失败的问题
Microsoft Teams 最常见的错误之一是“安装失败”错误,当 Teams 尝试更新时可能会出现该错误。每次更新时都会出现此错误,并且非常烦人。
简单地重新安装 Teams 并不是解决方案。目前可以使用,但该错误可能会在下次更新时再次出现。
真正解决问题的唯一方法是删除本地缓存并重新启动 Microsoft Teams:
- 关闭微软团队
- 按Windows键 + R
- 输入 %appdata% 并按 Enter 键
- 打开文件夹Microsoft
- 删除文件夹团队
5. 重启团队
您还可以使用下面的 PowerShell 脚本来删除 Microsoft Teams 缓存。
卸载微软团队
我们从简单的部分开始,只需卸载 Microsoft Teams。有些人评论说,他们的 Microsoft Teams 在卸载后不断重新安装。这大多数时候是由机器范围安装程序引起的。
因此,要完全卸载 Microsoft Teams,您必须删除 Microsoft Teams 和 Teams 计算机范围安装程序。
- 打开设置> 应用程序> 应用程序和功能
- 搜索团队
- 删除所有应用程序(是的,我有两个机器范围的安装程序......不要问为什么)
使用 PowerShell 卸载 Microsoft Teams
我喜欢尽可能地自动化操作,所以当然,我们还有一个 PowerShell 脚本来卸载 Microsoft Teams。
该脚本将删除机器范围安装程序和 Microsoft Teams 自身。确保在提升模式下运行 PowerShell 脚本。您可以通过以管理员身份打开 PowerShell 来执行此操作
function unInstallTeams($path) {
$clientInstaller = "$($path)\Update.exe"
try {
$process = Start-Process -FilePath "$clientInstaller" -ArgumentList "--uninstall /s" -PassThru -Wait -ErrorAction STOP
if ($process.ExitCode -ne 0)
{
Write-Error "UnInstallation failed with exit code $($process.ExitCode)."
}
}
catch {
Write-Error $_.Exception.Message
}
}
# Remove Teams Machine-Wide Installer
Write-Host "Removing Teams Machine-wide Installer" -ForegroundColor Yellow
$MachineWide = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Teams Machine-Wide Installer"}
$MachineWide.Uninstall()
# Remove Teams for Current Users
$localAppData = "$($env:LOCALAPPDATA)\Microsoft\Teams"
$programData = "$($env:ProgramData)$($env:USERNAME)\Microsoft\Teams"
If (Test-Path "$($localAppData)\Current\Teams.exe")
{
unInstallTeams($localAppData)
}
elseif (Test-Path "$($programData)\Current\Teams.exe") {
unInstallTeams($programData)
}
else {
Write-Warning "Teams installation not found"
}
该脚本将检查 Teams 的两个可能的安装位置,并在找到时将其删除。
如果您想为多个用户(在同一台计算机上)运行此脚本,则可以使用以下部分代替“删除当前用户的团队”部分:
# Get all Users
$Users = Get-ChildItem -Path "$($ENV:SystemDrive)\Users"
# Process all the Users
$Users | ForEach-Object {
Write-Host "Process user: $($_.Name)" -ForegroundColor Yellow
#Locate installation folder
$localAppData = "$($ENV:SystemDrive)\Users$($_.Name)\AppData\Local\Microsoft\Teams"
$programData = "$($env:ProgramData)$($_.Name)\Microsoft\Teams"
If (Test-Path "$($localAppData)\Current\Teams.exe")
{
unInstallTeams($localAppData)
}
elseif (Test-Path "$($programData)\Current\Teams.exe") {
unInstallTeams($programData)
}
else {
Write-Warning "Teams installation not found for user $($_.Name)"
}
}
卸载 Teams 计算机范围内的安装程序
需要明确的是,您可以安全地卸载 Teams 计算机范围内的安装程序。它所做的只是为每个登录的用户安装 Teams。
您可以在设置屏幕中或使用 PowerShell 脚本卸载 Teams 计算机范围内的安装程序。
- 打开设置> 应用程序> 应用程序和功能
- 搜索团队
- 卸载 Teams 计算机范围安装程序
您还可以使用 PowerShell 删除 Teams 计算机范围安装程序。如果您需要从多台计算机上删除它,这非常有用。确保在提升模式下运行 PowerShell 脚本。
您可以从开始菜单以管理员身份打开 PowerShell。
# Remove Teams Machine-Wide Installer
Write-Host "Removing Teams Machine-wide Installer" -ForegroundColor Yellow
$MachineWide = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Teams Machine-Wide Installer"}
$MachineWide.Uninstall()
Microsoft Teams 清除缓存
因此,我有一次不得不为用户删除 Microsoft Teams,但重新安装 Teams 后却没有任何历史记录。解决此问题的唯一解决方案是清除 Microsoft Teams 的缓存。
问题是 Microsoft Teams 的缓存没有一个位置。我预计它会在漫游 AppData 中,但事实证明它不是唯一的位置。我们还需要清除 Chrome 和 Edge 缓存才能将其完全删除。
Mark Vale 已经创建了一个非常好的 PowerShell 脚本来清除 Microsoft Teams 缓存,因此我们将使用它:
# Author: Mark Vale
$clearCache = Read-Host "Do you want to delete the Teams Cache (Y/N)?"
$clearCache = $clearCache.ToUpper()
if ($clearCache -eq "Y"){
Write-Host "Stopping Teams Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Teams Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Teams Disk Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\application cache\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" | Remove-Item -Confirm:$false
Write-Host "Teams Disk Cache Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping Chrome Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Chrome| Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Chrome Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Chrome Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cookies" -File | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Web Data" -File | Remove-Item -Confirm:$false
Write-Host "Chrome Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping IE Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName MicrosoftEdge | Stop-Process -Force
Get-Process -ProcessName IExplore | Stop-Process -Force
Write-Host "Internet Explorer and Edge Processes Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing IE Cache" -ForegroundColor Yellow
try{
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 2
Write-Host "IE and Edge Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Cleanup Complete... Launching Teams" -ForegroundColor Green
Start-Process -FilePath $env:LOCALAPPDATA\Microsoft\Teams\current\Teams.exe
Stop-Process -Id $PID
}
此脚本只会清除 Microsoft Teams 的缓存并在完成后重新启动 Teams。
您还可以结合清理和删除脚本来一次运行完成所有操作:
# Clearing Teams Cache by Mark Vale
# Uninstall Teams by Rudy Mens
$clearCache = Read-Host "Do you want to delete the Teams Cache (Y/N)?"
$clearCache = $clearCache.ToUpper()
$uninstall= Read-Host "Do you want to uninstall Teams completely (Y/N)?"
$uninstall= $uninstall.ToUpper()
if ($clearCache -eq "Y"){
Write-Host "Stopping Teams Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Teams Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Teams Disk Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\application cache\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" | Remove-Item -Confirm:$false
Write-Host "Teams Disk Cache Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping Chrome Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName Chrome| Stop-Process -Force
Start-Sleep -Seconds 3
Write-Host "Chrome Process Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing Chrome Cache" -ForegroundColor Yellow
try{
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cache" | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Cookies" -File | Remove-Item -Confirm:$false
Get-ChildItem -Path $env:LOCALAPPDATA"\Google\Chrome\User Data\Default\Web Data" -File | Remove-Item -Confirm:$false
Write-Host "Chrome Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Stopping IE Process" -ForegroundColor Yellow
try{
Get-Process -ProcessName MicrosoftEdge | Stop-Process -Force
Get-Process -ProcessName IExplore | Stop-Process -Force
Write-Host "Internet Explorer and Edge Processes Sucessfully Stopped" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Clearing IE Cache" -ForegroundColor Yellow
try{
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 8
RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 2
Write-Host "IE and Edge Cleaned" -ForegroundColor Green
}catch{
echo $_
}
Write-Host "Cleanup Complete..." -ForegroundColor Green
}
if ($uninstall -eq "Y"){
Write-Host "Removing Teams Machine-wide Installer" -ForegroundColor Yellow
$MachineWide = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Teams Machine-Wide Installer"}
$MachineWide.Uninstall()
function unInstallTeams($path) {
$clientInstaller = "$($path)\Update.exe"
try {
$process = Start-Process -FilePath "$clientInstaller" -ArgumentList "--uninstall /s" -PassThru -Wait -ErrorAction STOP
if ($process.ExitCode -ne 0)
{
Write-Error "UnInstallation failed with exit code $($process.ExitCode)."
}
}
catch {
Write-Error $_.Exception.Message
}
}
#Locate installation folder
$localAppData = "$($env:LOCALAPPDATA)\Microsoft\Teams"
$programData = "$($env:ProgramData)$($env:USERNAME)\Microsoft\Teams"
If (Test-Path "$($localAppData)\Current\Teams.exe")
{
unInstallTeams($localAppData)
}
elseif (Test-Path "$($programData)\Current\Teams.exe") {
unInstallTeams($programData)
}
else {
Write-Warning "Teams installation not found"
}
}
总结
我希望这些脚本可以帮助您删除和清理 Microsoft Teams。如果您想重新安装 Microsoft Teams,请务必查看这篇文章。
如果您有任何疑问,请在下面发表评论。
再次感谢 Mark Vale 提供的清理脚本!
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag