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
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
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
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
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.
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
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.
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.
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.
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.