Edit

Get-AzBatchNodeFile

Gets the properties of Batch node files.

Syntax

ComputeNode_Id (Default)

Get-AzBatchNodeFile
    [-PoolId] <String>
    [-ComputeNodeId] <String>
    [[-Path] <String>]
    -BatchContext <BatchAccountContext>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Task_Id

Get-AzBatchNodeFile
    [[-Path] <String>]
    -JobId <String>
    -TaskId <String>
    -BatchContext <BatchAccountContext>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Task_ODataFilter

Get-AzBatchNodeFile
    -JobId <String>
    -TaskId <String>
    -BatchContext <BatchAccountContext>
    [-Filter <String>]
    [-MaxCount <Int32>]
    [-Recursive]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ParentTask

Get-AzBatchNodeFile
    [[-Task] <PSCloudTask>]
    -BatchContext <BatchAccountContext>
    [-Filter <String>]
    [-MaxCount <Int32>]
    [-Recursive]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ComputeNode_ODataFilter

Get-AzBatchNodeFile
    [-PoolId] <String>
    [-ComputeNodeId] <String>
    -BatchContext <BatchAccountContext>
    [-Filter <String>]
    [-MaxCount <Int32>]
    [-Recursive]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ParentComputeNode

Get-AzBatchNodeFile
    [[-ComputeNode] <PSComputeNode>]
    -BatchContext <BatchAccountContext>
    [-Filter <String>]
    [-MaxCount <Int32>]
    [-Recursive]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzBatchNodeFile cmdlet gets the properties of the Azure Batch node files of a task or compute node. To narrow your results, you can specify an Open Data Protocol (OData) filter. To get one file, specify its path with the Path parameter (see Examples 1 and 5). To list the node files of a task, pipe the task from Get-AzBatchTask (see Example 3). This lists the files in the task's folder; to include its subfolders, also specify the Recursive parameter (see Example 4). For a compute node, the cmdlet lists the entries directly in the node's root folder; to include its subfolders, also specify Recursive (see Examples 6 and 7). For each task or compute node, the list has up to 1,000 entries (files and folders) by default; a positive MaxCount sets a different cap, and a MaxCount of 0 or less removes it. To get the whole tree, specify -Recursive -MaxCount 0 without Filter, because a filter still applies (see Example 4). If you specify the task with the JobId and TaskId parameters, also specify Path to get one file, or Filter, MaxCount or Recursive to get a list: with only JobId and TaskId, PowerShell can't choose a parameter set.

Examples

Example 1: Get the properties of a node file associated with a task

Get-AzBatchNodeFile -JobId "Job-000001" -TaskId "Task26" -Path "Stdout.txt" -BatchContext $Context
IsDirectory Name          Properties                                      Url

----------- ----          ----------                                      ---

False       StdOut.txt    Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...

This command gets the properties of the StdOut.txt node file associated with the task that has the ID Task26 in the job that has the ID Job-000001. Use the Get-AzBatchAccountKey cmdlet to assign a context to the $Context variable.

Example 2: Get the properties of node files associated with a task by using a filter

Get-AzBatchNodeFile -JobId "Job-00002" -TaskId "Task26" -Filter "startswith(name,'St')" -BatchContext $Context
IsDirectory Name        Properties                                      Url

----------- ----        ----------                                      ---

False       StdErr.txt  Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       StdOut.txt  Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...

This command gets the properties of the node files whose names start with st and are associated with task that has the ID Task26 under job that has the ID Job-00002.

Example 3: Get the properties of the node files in a task's folder

Get-AzBatchTask -JobId "Job-00002" -Id "Task26" -BatchContext $Context | Get-AzBatchNodeFile -BatchContext $Context
IsDirectory Name             Properties                                      Url

----------- ----             ----------                                      ---

False       ProcessEnv.cmd   Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       StdErr.txt       Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       StdOut.txt       Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
True        wd                                                               https://cmdletexample.westus.Batch.contoso...

This command gets the properties of the node files in the folder of the task that has the ID Task26 in the job that has the ID Job-00002. It doesn't list the files inside subfolders such as wd, and it returns at most 1,000 entries. To get every file of the task, add the Recursive parameter and -MaxCount 0 (see Example 4).

Example 4: Recursively get the properties of all node files associated with a task

Get-AzBatchTask "Job-00003" "Task31" -BatchContext $Context | Get-AzBatchNodeFile -Recursive -MaxCount 0 -BatchContext $Context
IsDirectory Name             Properties                                      Url

----------- ----             ----------                                      ---

False       ProcessEnv.cmd   Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       StdErr.txt       Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       StdOut.txt       Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
True        wd                                                               https://cmdletexample.westus.Batch.contoso...
False       wd\newFile.txt   Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...

This command gets the properties of all files associated with the task that has the ID Task31 in job Job-00003. This command specifies the Recursive parameter. Therefore, the cmdlet performs a recursive file search is performed, and returns the wd\newFile.txt node file. It also specifies -MaxCount 0, so the cmdlet doesn't stop at 1,000 entries.

Example 5: Get a single file from a compute node

Get-AzBatchNodeFile -PoolId "Pool22" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -BatchContext $Context
IsDirectory Name                    Properties                                      Url
----------- ----                    ----------                                      ---
False       startup\stdout.txt      Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...

This command gets the file that is named Startup\StdOut.txt from the compute node that has the ID ComputeNode01 in the pool that has the ID Pool22.

Example 6: Recursively get the node files whose names start with "startup" from a compute node

Get-AzBatchNodeFile -PoolId "Pool22" -ComputeNodeId "ComputeNode01" -Filter "startswith(name,'startup')" -Recursive -BatchContext $Context
IsDirectory Name                      Properties                                      Url
----------- ----                      ----------                                      ---
True        startup                                                                   https://cmdletexample.westus.Batch.contoso...
False       startup\ProcessEnv.cmd    Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       startup\stderr.txt        Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
False       startup\stdout.txt        Microsoft.Azure.Commands.Batch.Models.PSFile... https://cmdletexample.westus.Batch.contoso...
True        startup\wd                                                                https://cmdletexample.westus.Batch.contoso...

This command recursively lists up to 1,000 entries whose names start with "startup" on the compute node that has the ID ComputeNode01 in the pool that has the ID Pool22. The filter matches a name prefix, not a folder. The filter can match both the startup folder and nested entries such as startup\stdout.txt.

Example 7: Get files from the root folder of a compute node

Get-AzBatchComputeNode "Pool22" -Id "ComputeNode01" -BatchContext $Context | Get-AzBatchNodeFile -BatchContext $Context
IsDirectory Name           Properties       Url
----------- ----           ----------       ---
True        shared                          https://cmdletexample.westus.Batch.contoso...
True        startup                         https://cmdletexample.westus.Batch.contoso...
True        workitems                       https://cmdletexample.westus.Batch.contoso...

This command lists up to 1,000 entries directly in the root folder of the compute node that has the ID ComputeNode01 in the pool that has the ID Pool22.

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

-ComputeNode

Specifies the compute node, as a PSComputeNode object, that contains the Batch node files. To obtain a compute node object, use the Get-AzBatchComputeNode cmdlet.

Parameter properties

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

Parameter sets

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

-ComputeNodeId

Specifies the ID of the compute node that contains the Batch node files.

Parameter properties

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

Parameter sets

ComputeNode_Id
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ComputeNode_ODataFilter
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

-Filter

Specifies an OData filter clause. This cmdlet returns properties for node files that match the filter that this parameter specifies.

Parameter properties

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

Parameter sets

Task_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentTask
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentComputeNode
Position:Named
Mandatory:False
Value from pipeline:False
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
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
Task_ODataFilter
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-MaxCount

Specifies the maximum number of node files for which this cmdlet returns properties. If you specify a value of zero (0) or less, the cmdlet does not use an upper limit. The default value is 1000.

Parameter properties

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

Parameter sets

Task_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentTask
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentComputeNode
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

Specifies the path of the node file for which this cmdlet retrieves properties. You cannot specify wildcard characters.

Parameter properties

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

Parameter sets

ComputeNode_Id
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
Task_Id
Position:2
Mandatory:False
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 from which to get properties of node files.

Parameter properties

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

Parameter sets

ComputeNode_Id
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ComputeNode_ODataFilter
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Recursive

Indicates that this cmdlet returns a recursive list of files. Otherwise, it returns only the files in the root folder.

Parameter properties

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

Parameter sets

Task_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentTask
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ComputeNode_ODataFilter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ParentComputeNode
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Task

Specifies the task, as a PSCloudTask object, with which the node files are associated. To obtain a task object, use the Get-AzBatchTask cmdlet.

Parameter properties

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

Parameter sets

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

-TaskId

Specifies the ID of the task for which this cmdlet gets properties of node files.

Parameter properties

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

Parameter sets

Task_Id
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
Task_ODataFilter
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

PSCloudTask

PSComputeNode

BatchAccountContext

Outputs

PSNodeFile