Get-AzBatchRemoteDesktopProtocolFile

Gets an RDP file from a compute node.

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

The Get-AzBatchRemoteDesktopProtocolFile cmdlet gets a Remote Desktop Protocol (RDP) file from a compute node and saves it as a file or to a user supplied stream.

Examples

Example 1: Get an RDP file from a specified compute node and save the file

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

This command gets an RDP file from the compute node that has the ID ComputeNode01 in the pool that has the ID Pool06. The command saves the .rdp file as C:\PowerShell\MyComputeNode.rdp. Use the Get-AzBatchAccountKey cmdlet to assign a context to the $Context variable.

Example 2: Get an RDP file from a compute node and save the file by using the pipeline

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

This command gets the compute node that has the ID ComputeNode02 in the pool that has the ID Pool06. The command passes that compute node to the current cmdlet by using the pipeline operator. The current cmdlet gets an .rpd file from the compute node, and then saves the contents as a file that is named C:\PowerShell\MyComputeNode02.rdp.

Example 3: Get a RDP file from a specified compute node and direct it to a stream

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

The first command creates a stream by using the New-Object cmdlet, and then stores it in the $Stream variable. The second command gets an .rdp file from the compute node that has the ID ComputeNode03 in the pool that has the ID Pool06. The command directs file contents to the stream in $Stream.

Parameters

-BatchContext

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. If you use the Get-AzBatchAccount cmdlet to get your BatchAccountContext, then Microsoft Entra authentication will be used when interacting with the Batch service. To use shared key authentication instead, use the Get-AzBatchAccountKey cmdlet to get a BatchAccountContext object with its access keys populated. When using shared key authentication, the primary access key is used by default. To change the key to use, set the BatchAccountContext.KeyInUse property.

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

-ComputeNode

Specifies a compute node, as a PSComputeNode object, to which the .rdp file points. To obtain a compute node object, use the Get-AzBatchComputeNode cmdlet.

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

-ComputeNodeId

Specifies the ID of the compute node to which the .rdp file points.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

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

-DestinationPath

Specifies the file path where this cmdlet saves the .rdp file.

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

-DestinationStream

Specifies the stream into which this cmdlet directs the RDP data. This cmdlet does not close or rewind this stream.

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

-PoolId

Specifies the ID of the pool that contains the compute node from which this cmdlet gets an .rdp file.

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

Inputs

String

PSComputeNode

BatchAccountContext

Outputs

Void