Bewerken

Delen via


Get-AzBatchNodeFile

Gets the properties of Batch node files.

Syntax

Get-AzBatchNodeFile
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [[-Path] <String>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFile
   -JobId <String>
   -TaskId <String>
   [[-Path] <String>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFile
   -JobId <String>
   -TaskId <String>
   [-Filter <String>]
   [-MaxCount <Int32>]
   [-Recursive]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFile
   [[-Task] <PSCloudTask>]
   [-Filter <String>]
   [-MaxCount <Int32>]
   [-Recursive]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFile
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [-Filter <String>]
   [-MaxCount <Int32>]
   [-Recursive]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFile
   [[-ComputeNode] <PSComputeNode>]
   [-Filter <String>]
   [-MaxCount <Int32>]
   [-Recursive]
   -BatchContext <BatchAccountContext>
   [-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. If you specify a task, but not a filter, this cmdlet returns properties for all node files for that task. If you specify a compute node, but not a filter, this cmdlet returns properties for all node files for that compute node.

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: Recursively get the properties of node files associated with a task

Get-AzBatchTask "Job-00003" "Task31" -BatchContext $Context | Get-AzBatchNodeFile -Recursive -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.

Example 4: 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 5: Get all files under a folder 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 gets all the files under the startup folder from the compute node that has the ID ComputeNode01 in the pool that has the ID Pool22. This cmdlet specifies the Recursive parameter.

Example 6: 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 gets all the files at 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.

Type:BatchAccountContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters: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.

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

-ComputeNodeId

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

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

-Filter

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

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

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

-Path

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

Type:String
Aliases:Name
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PoolId

Specifies the ID of the pool that contains the compute node from which to get properties of node files.

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

-Recursive

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

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

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

-TaskId

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

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

Inputs

String

PSCloudTask

PSComputeNode

BatchAccountContext

Outputs

PSNodeFile