適用于 Windows PowerShell 的 Windows 虛擬桌面 Cmdlet

歡迎使用適用于 Windows 虛擬桌面的 PowerShell 參考。 您可以在這裡找到以 Windows 虛擬桌面為目標的 PowerShell 模組資源。

支援的 PowerShell 版本

  • Windows PowerShell 5.0 和 5.1

注意

Windows 虛擬桌面模組並非建置在 .NET Core 上,因此無法在 macOS、Linux、Azure Cloud Shell上執行,以及支援 PowerShell Core 6.x 或 PowerShell Core 7.0 的位置。

下載

您可以使用 PowerShellGet 模組,從PowerShell 資源庫下載並安裝 Windows 虛擬桌面模組。

若要快速下載並安裝 Windows 虛擬桌面 PowerShell 模組,請以系統管理員身分啟動 PowerShell 並執行下列命令:

Install-Module -Name Microsoft.RDInfra.RDPowerShell

在執行 Cmdlet 之前,您可能也需要匯入 Windows 虛擬桌面 PowerShell 模組:

Import-Module -Name Microsoft.RDInfra.RDPowerShell

您現在可以執行 Windows 虛擬桌面 Cmdlet。 如果您關閉 PowerShell 會話,您可能需要將模組重新匯入任何新的會話會話。

更新

如果您使用舊版的 PowerShell 模組,您可以執行下列命令來更新為最新版本:

Update-Module -Name Microsoft.RDInfra.RDPowerShell

這會導致並存安裝。 如果您想要在系統上只安裝一個版本,請卸載模組,然後重新安裝。