Get-​Azure​Batch​Node​File​Content

Gets a Batch node file.

Syntax

Get-AzureBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   -BatchContext <BatchAccountContext>
   -DestinationPath <String>
   -Name <String>
   [<CommonParameters>]
Get-AzureBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   -BatchContext <BatchAccountContext>
   -DestinationStream <Stream>
   -Name <String>
   [<CommonParameters>]
Get-AzureBatchNodeFileContent
   -BatchContext <BatchAccountContext>
   -DestinationPath <String>
   -JobId <String>
   -Name <String>
   -TaskId <String>
   [<CommonParameters>]
Get-AzureBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -BatchContext <BatchAccountContext>
   -DestinationPath <String>
   [<CommonParameters>]
Get-AzureBatchNodeFileContent
   -BatchContext <BatchAccountContext>
   -DestinationStream <Stream>
   -JobId <String>
   -Name <String>
   -TaskId <String>
   [<CommonParameters>]
Get-AzureBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -BatchContext <BatchAccountContext>
   -DestinationStream <Stream>
   [<CommonParameters>]

Description

The Get-AzureBatchNodeFileContent 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

PS C:\>Get-AzureBatchNodeFileContent -JobId "Job01" -TaskId "Task01" -Name "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-AzureRmBatchAccountKeys 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

PS C:\>Get-AzureBatchNodeFile -JobId "Job02" -TaskId "Task02" -Name "StdErr.txt" -BatchContext $Context | Get-AzureBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file that is named StdErr.txt by using the Get-AzureBatchNodeFile 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

PS C:\>$Stream = New-Object -TypeName "System.IO.MemoryStream"
PS C:\> Get-AzureBatchNodeFileContent -JobId "Job03" -TaskId "Task11" -Name "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

PS C:\>Get-AzureBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Name "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

PS C:\>Get-AzureBatchNodeFile -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Name "Startup\StdOut.txt" -BatchContext $Context | Get-AzureBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

This command gets the node file Startup\StdOut.txt by using Get-AzureBatchNodeFile 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

PS C:\>$Stream = New-Object -TypeName "System.IO.MemoryStream"
PS C:\> Get-AzureBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Name "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.

Required Parameters

-BatchContext

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. To obtain a BatchAccountContext object that contains access keys for your subscription, use the Get-AzureRmBatchAccountKeys cmdlet.

Type:BatchAccountContext
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DestinationPath

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

Type:String
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-JobId

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the node file that this cmdlet retrieves. You cannot specify wildcard characters.

Type:String
Position:Named
Default value:None
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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TaskId

Specifies the ID of the task.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-InputObject

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

Type:PSNodeFile
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False