Edit

Share via


Get-AzBatchNodeFileContent

Gets a Batch node file.

Syntax

Task_Id_Path

Get-AzBatchNodeFileContent
    [-Path] <String>
    -JobId <String>
    -TaskId <String>
    -DestinationPath <String>
    -BatchContext <BatchAccountContext>
    [-ByteRangeStart <Int64>]
    [-ByteRangeEnd <Int64>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Task_Id_Stream

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

ComputeNode_Id_Path

Get-AzBatchNodeFileContent
    [-PoolId] <String>
    [-ComputeNodeId] <String>
    [-Path] <String>
    -DestinationPath <String>
    -BatchContext <BatchAccountContext>
    [-ByteRangeStart <Int64>]
    [-ByteRangeEnd <Int64>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ComputeNode_Id_Stream

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

InputObject_Path

Get-AzBatchNodeFileContent
    [[-InputObject] <PSNodeFile>]
    -DestinationPath <String>
    -BatchContext <BatchAccountContext>
    [-ByteRangeStart <Int64>]
    [-ByteRangeEnd <Int64>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

InputObject_Stream

Get-AzBatchNodeFileContent
    [[-InputObject] <PSNodeFile>]
    -DestinationStream <Stream>
    -BatchContext <BatchAccountContext>
    [-ByteRangeStart <Int64>]
    [-ByteRangeEnd <Int64>]
    [-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.

Parameter properties

Type:BatchAccountContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ByteRangeEnd

The end of the byte range to be downloaded.

Parameter properties

Type:

Nullable<T>[Int64]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ByteRangeStart

The start of the byte range to be downloaded.

Parameter properties

Type:

Nullable<T>[Int64]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputeNodeId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ComputeNode_Id_Path
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ComputeNode_Id_Stream
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DestinationPath

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Task_Id_Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_Id_Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
InputObject_Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DestinationStream

Specifies the stream into which this cmdlet writes the node file contents. This cmdlet does not close or rewind this stream.

Parameter properties

Type:Stream
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Task_Id_Stream
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_Id_Stream
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
InputObject_Stream
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

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

Parameter properties

Type:PSNodeFile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject_Path
Position:0
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
InputObject_Stream
Position:0
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-JobId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Task_Id_Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
Task_Id_Stream
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

The path of the node file to download.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Name

Parameter sets

Task_Id_Path
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
Task_Id_Stream
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_Id_Path
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_Id_Stream
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PoolId

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ComputeNode_Id_Path
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ComputeNode_Id_Stream
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TaskId

Specifies the ID of the task.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Task_Id_Path
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
Task_Id_Stream
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

PSNodeFile

BatchAccountContext

Outputs

Void