Get-AzBatchNodeFileContent

Gets a Batch node file.

Syntax

Get-AzBatchNodeFileContent
   -JobId <String>
   -TaskId <String>
   [-Path] <String>
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   -JobId <String>
   -TaskId <String>
   [-Path] <String>
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [-Path] <String>
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [-Path] <String>
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzBatchNodeFileContent cmdlet gets an Azure Batch node file and saves it as a file or to a stream.

Examples

Example 1: Get a Batch node file associated with a task and save the file

Get-AzBatchNodeFileContent -JobId "Job01" -TaskId "Task01" -Path "StdOut.txt" -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file that is named StdOut.txt, and saves it to the E:\PowerShell\StdOut.txt file path on the local computer. The StdOut.txt node file is associated with task that has the ID Task01 for the job that has the ID Job01. Use the Get-AzBatchAccountKey cmdlet to assign a context to the $Context variable.

Example 2: Get a Batch node file and save it to a specified file path using the pipeline

Get-AzBatchNodeFile -JobId "Job02" -TaskId "Task02" -Path "StdErr.txt" -BatchContext $Context | Get-AzBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file that is named StdErr.txt by using the Get-AzBatchNodeFile cmdlet. The command passes that file to the current cmdlet by using the pipeline operator. The current cmdlet saves that file to the E:\PowerShell\StdOut.txt file path on the local computer. The StdOut.txt node file is associated with the task that has the ID Task02 for the job that has the ID Job02.

Example 3: Get a Batch node file associated with a task and direct it to a stream

$Stream = New-Object -TypeName "System.IO.MemoryStream"
Get-AzBatchNodeFileContent -JobId "Job03" -TaskId "Task11" -Path "StdOut.txt" -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 the node file that is named StdOut.txt from the task that has the ID Task11 for the job that has the ID Job03. The command directs file contents to the stream in $Stream.

Example 4: Get a node file from a compute node and save it

Get-AzBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file Startup\StdOut.txt from the compute node that has the ID ComputeNode01 in the pool that has the ID Pool01. The command saves the file to the E:\PowerShell\StdOut.txt file path on the local computer.

Example 5: Get a node file from a compute node and save it by using the pipeline

Get-AzBatchNodeFile -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -BatchContext $Context | Get-AzBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file Startup\StdOut.txt by using Get-AzBatchNodeFile from the compute node that has the ID ComputeNode01. The compute node is in the pool that has the ID Pool01. The command passes that node file to the current cmdlet. That cmdlet saves the file to the E:\PowerShell\StdOut.txt file path on the local computer.

Example 6: Get a node file from a compute node and direct it to a stream

$Stream = New-Object -TypeName "System.IO.MemoryStream"
Get-AzBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "startup\stdout.txt" -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 the node file that is named StdOut.txt from the compute node that has the ID ComputeNode01 in the pool that has the ID Pool01. 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

-ByteRangeEnd

The end of the byte range to be downloaded.

Type:Nullable<T>[Int64]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ByteRangeStart

The start of the byte range to be downloaded.

Type:Nullable<T>[Int64]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputeNodeId

Specifies the ID of the compute node that contains the node file that this cmdlet returns.

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 node 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 writes the node file contents. 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

-InputObject

Specifies the file that this cmdlet gets, as a PSNodeFile object. To obtain a node file object, use the Get-AzBatchNodeFile cmdlet.

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

-JobId

Specifies the ID of the job that contains the target task.

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

-Path

The path of the node file to download.

Type:String
Aliases:Name
Position:2
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 that contains the node file that this cmdlet gets.

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

-TaskId

Specifies the ID of the task.

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

Inputs

String

PSNodeFile

BatchAccountContext

Outputs

Void