安裝 Microsoft Teams PowerShell 模組
本文將說明如何使用 PowerShell 圖庫Microsoft Teams PowerShell 模組。 所有Microsoft Teams平臺都支援 PowerShell 模組Windows模組。 不支援 Mac 和 Linux。
需求
Microsoft Teams PowerShell 模組在所有平臺上都需要 PowerShell 5.1 或更高版本。 為 作業系統安裝最新版的 PowerShellavailable 。
若要檢查 PowerShell 版本,請在 PowerShell 會話內執行下列命令:
$PSVersionTable.PSVersion
我們建議您使用 Install-Module Cmdlet 來安裝 Microsoft Teams PowerShell 模組。
如果 PowerShell 圖庫 (PSGallery) 未配置為 PowerShellGet 的受信任的存放庫,當您第一次使用 PSGallery 時,會看到下列訊息:
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change
its InstallationPolicy value by running the `Set-PSRepository` cmdlet.
Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
回答 是 或 全部是 以繼續安裝。
使用 PowerShellGallery 安裝
Microsoft Teams PowerShell 模組目前支援與 PowerShell 5.1 一Windows。 請遵循下列步驟安裝模組:
- 更新至Windows PowerShell 5.1。 如果您是使用 1607 Windows 10版本,表示您已安裝 PowerShell 5.1。
- 安裝.NET Framework 4.7.2或更新版。
- 執行下列命令以安裝最新的 PowerShellGet:
Install-Module -Name PowerShellGet -Force -AllowClobber
- 安裝 powerShell Teams模組。
Install-Module -Name MicrosoftTeams -Force -AllowClobber
離線安裝
在某些環境中,無法連接到 PowerShell 圖庫。 在這些情況下,請遵循這些 手動安裝步驟。
登錄
若要開始使用 PowerShell 模組Microsoft Teams,請以 Azure 認證來登錄。
Connect-MicrosoftTeams
更新 Teams PowerShell 模組
若要更新任何 PowerShell 模組,您應該使用與安裝模組相同的方法。 例如,如果您原本是使用 Install-Module,您應該使用 Update-Module 取得最新版本。
Update-Module MicrosoftTeams
警告
如果Teams PowerShell 已導入 PowerShell 會話,更新模組將會失敗。 關閉 PowerShell,然後重新開啟新的提升的 PowerShell 會話。
卸載 Teams PowerShell
若要卸載 powerShell Microsoft Teams,請開啟新的 PowerShell 命令提示,然後執行下列操作:
Uninstall-Module MicrosoftTeams
# Uninstall all versions of the module
Uninstall-Module MicrosoftTeams -Allversions
後續步驟
現在,您可以使用 PowerShell Microsoft Teams管理Microsoft Teams程式。 請參閱使用 powerShell Teams管理Teams以開始使用。