Get-AzBatchRemoteDesktopProtocolFile

從計算節點取得 RDP 檔案。

Syntax

Get-AzBatchRemoteDesktopProtocolFile
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   -DestinationPath <String>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchRemoteDesktopProtocolFile
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   -DestinationStream <Stream>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchRemoteDesktopProtocolFile
   [[-ComputeNode] <PSComputeNode>]
   -DestinationPath <String>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchRemoteDesktopProtocolFile
   [[-ComputeNode] <PSComputeNode>]
   -DestinationStream <Stream>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Get-AzBatchRemoteDesktopProtocolFile Cmdlet 會從計算節點取得遠端桌面通訊協定 (RDP) 檔案,並將其儲存為檔案或使用者提供的數據流。

範例

範例 1:從指定的計算節點取得 RDP 檔案並儲存盤案

Get-AzBatchRemoteDesktopProtocolFile -PoolId "Pool06" -ComputeNodeId "ComputeNode01" -DestinationPath "C:\PowerShell\ComputeNode01.rdp" -BatchContext $Context

此命令會從具有ID Pool06之集區中標識碼 ComputeNode01 的計算節點取得 RDP 檔案。 此命令會將 .rdp 檔案儲存為 C:\PowerShell\MyComputeNode.rdp。 使用 Get-AzBatchAccountKey Cmdlet 將內容指派給$Context變數。

範例 2:從計算節點取得 RDP 檔案,並使用管線儲存盤案

Get-AzBatchComputeNode -PoolId "Pool06" -Id "ComputeNode02" -BatchContext $Context | Get-AzBatchRemoteDesktopProtocolFile -DestinationPath "C:\PowerShell\MyComputeNode02.rdp" -BatchContext $Context

此命令會取得具有ID Pool06集區中標識碼 ComputeNode02 的計算節點。 命令會使用管線運算符,將計算節點傳遞至目前的 Cmdlet。 目前的 Cmdlet 會從計算節點取得 .rpd 檔案,然後將內容儲存為名為 C:\PowerShell\MyComputeNode02.rdp 的檔案。

範例 3:從指定的計算節點取得 RDP 檔案,並將它導向至數據流

$Stream = New-Object -TypeName "System.IO.MemoryStream"
Get-AzBatchRemoteDesktopProtocolFile "Pool06" -ComputeNodeId "ComputeNode03" -DestinationStream $Stream -BatchContext $Context

第一個命令會使用 New-Object Cmdlet 建立資料流,然後將它儲存在$Stream變數中。 第二個命令會從具有ID Pool06之集區中標識碼 ComputeNode03 的計算節點取得 .rdp 檔案。 命令會將檔案內容導向$Stream中的數據流。

參數

-BatchContext

指定 此 Cmdlet 用來與 Batch 服務互動的 BatchAccountContext 實例。 如果您使用 Get-AzBatchAccount Cmdlet 來取得 BatchAccountContext,則與 Batch 服務互動時,將會使用 Microsoft Entra 驗證。 若要改用共用密鑰驗證,請使用 Get-AzBatchAccountKey Cmdlet 來取得已填入其存取密鑰的 BatchAccountContext 物件。 使用共用金鑰驗證時,預設會使用主要存取金鑰。 若要變更要使用的密鑰,請設定 BatchAccountContext.KeyInUse 屬性。

Type:BatchAccountContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ComputeNode

將計算節點指定為 .rdp 檔案所指向的 PSComputeNode 物件。 若要取得計算節點物件,請使用 Get-AzBatchComputeNode Cmdlet。

Type:PSComputeNode
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ComputeNodeId

指定 .rdp 檔案所指向之計算節點的標識碼。

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶。

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DestinationPath

指定此 Cmdlet 儲存 .rdp 檔案的檔案路徑。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DestinationStream

指定此 Cmdlet 導向 RDP 資料的數據流。 此 Cmdlet 不會關閉或倒轉此資料流。

Type:Stream
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PoolId

指定集區的標識碼,其中包含這個 Cmdlet 從中取得 .rdp 檔案的計算節點。

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

輸入

String

PSComputeNode

BatchAccountContext

輸出

Void