PowerShell 腳本範例 - Teams 部署清理
使用此腳本移除 Teams。 此腳本會卸載 Teams,並移除使用者的 Teams 資料夾。 針對在電腦上安裝 Teams 的每個使用者設定檔執行此腳本。
範例腳本
<#
.SYNOPSIS
This script uninstalls the Teams app and removes the Teams directory for a user.
.DESCRIPTION
Use this script to remove and clear the Teams app from a computer. Run this PowerShell script for each user profile in which Teams was installed on the computer. After you run this script for all user profiles, redeploy Teams.
#>
$TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams')
$TeamsUpdateExePath = [System.IO.Path]::Combine($TeamsPath, 'Update.exe')
try
{
if ([System.IO.File]::Exists($TeamsUpdateExePath)) {
Write-Host "Uninstalling Teams process"
# Uninstall app
$proc = Start-Process $TeamsUpdateExePath "-uninstall -s" -PassThru
$proc.WaitForExit()
}
Write-Host "Deleting Teams directory"
Remove-Item –path $TeamsPath -recurse
}
catch
{
Write-Output "Uninstall failed with exception $_.exception.message"
exit /b 1
}
相關主題
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應