< Back

Get-AzureBatchTask

Tue Jan 29, 2019 9:35 pm

NAME Get-AzureBatchTask



SYNOPSIS

Gets the Batch tasks for a job.





SYNTAX

Get-AzureBatchTask [-JobId] <String> -BatchContext <BatchAccountContext> [-DefaultProfile <IAzureContextContainer>] [-Expand <String>] [-Filter

<String>] [-MaxCount <Int32>] [-Select <String>] [<CommonParameters>]



Get-AzureBatchTask [[-Job] <PSCloudJob>] -BatchContext <BatchAccountContext> [-DefaultProfile <IAzureContextContainer>] [-Expand <String>]

[-Filter <String>] [-MaxCount <Int32>] [-Select <String>] [<CommonParameters>]



Get-AzureBatchTask [-JobId] <String> [[-Id] <String>] -BatchContext <BatchAccountContext> [-DefaultProfile <IAzureContextContainer>] [-Expand

<String>] [-Select <String>] [<CommonParameters>]





DESCRIPTION

The Get-AzureBatchTask cmdlet gets Azure Batch tasks for a Batch job. Specify a job by either the JobId parameter or the Job parameter. To get a

single task, specify the Id parameter. You can specify the Filter parameter to get the tasks that match an Open Data Protocol (OData) filter.





PARAMETERS

-BatchContext <BatchAccountContext>

Specifies the BatchAccountContext instance that this cmdlet uses to interact with the Batch service. If you use the Get-AzureRmBatchAccount

cmdlet to get your BatchAccountContext, then Azure Active Directory authentication will be used when interacting with the Batch service. To

use shared key authentication instead, use the Get-AzureRmBatchAccountKeys 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.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Expand <String>

Specifies an OData expand clause. Specify a value for this parameter to get associated entities of the main entity to get.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Filter <String>

Specifies an OData filter clause for tasks. If you do not specify a filter, this cmdlet returns all tasks for the Batch account or job.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Id <String>

Specifies the ID of the task that this cmdlet gets. You cannot specify wildcard characters.



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Job <PSCloudJob>

Specifies the job that contains tasks that this cmdlet gets. To obtain a PSCloudJob object, use the Get-AzureBatchJob cmdlet.



Required? false

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-JobId <String>

Specifies the ID of the job that contains the tasks that this cmdlet gets.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-MaxCount <Int32>

Specifies the maximum number of tasks to return. If you specify a value of zero (0) or less, the cmdlet does not use an upper limit. The

default value is 1000.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Select <String>

Specifies an OData select clause. Specify a value for this parameter to get specific properties rather than all object properties.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

BatchAccountContext

Parameter 'BatchContext' accepts value of type 'BatchAccountContext' from the pipeline



PSCloudJob

Parameter 'Job' accepts value of type 'PSCloudJob' from the pipeline





OUTPUTS

PSCloudTask







NOTES









Example 1: Get a task by ID



PS C:\\>Get-AzureBatchTask -JobId "Job01" -Id "Task03" -BatchContext $Context

AffinityInformation :

CommandLine : cmd /c dir /s

ComputeNodeInformation : Microsoft.Azure.Commands.Batch.Models.PSComputeNodeInformation

Constraints : Microsoft.Azure.Commands.Batch.Models.PSTaskConstraints

CreationTime : 7/25/2015 11:24:52 PM

DisplayName :

EnvironmentSettings :

ETag : 0x8D295483E08BD9D

ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSTaskExecutionInformation

Id : Task03

LastModified : 7/25/2015 11:24:52 PM

PreviousState : Running

PreviousStateTransitionTime : 7/25/2015 11:24:59 PM

ResourceFiles :

RunElevated : False

State : Completed

StateTransitionTime : 7/25/2015 11:24:59 PM

Statistics :

Url : https://pfuller.westus.batch.azure.com/ ... sks/Task03



This command gets the task with ID Task03 under job Job01. Use the Get-AzureRmBatchAccountKeys cmdlet to assign a context to the $Context variable.





Example 2: Get all completed tasks from a specified job



PS C:\\>Get-AzureBatchTask -JobId "Job02" -Filter "state eq 'completed'" -BatchContext $Context

AffinityInformation :

CommandLine : cmd /c dir /s

ComputeNodeInformation : Microsoft.Azure.Commands.Batch.Models.PSComputeNodeInformation

Constraints : Microsoft.Azure.Commands.Batch.Models.PSTaskConstraints

CreationTime : 3/24/2015 10:21:51 PM

EnvironmentSettings :

ETag : 0x8D295483E08BD9D

ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSTaskExecutionInformation

Id : Task17

LastModified : 3/24/2015 10:21:51 PM

PreviousState : Running

PreviousStateTransitionTime : 3/24/2015 10:22:00 PM

ResourceFiles :

RunElevated : False

State : Completed

StateTransitionTime : 3/24/2015 10:22:00 PM

Statistics :

Url : https://pfuller.westus.batch.azure.com/ ... sks/Task17



AffinityInformation :

CommandLine : cmd /c echo hello > newFile.txt

ComputeNodeInformation : Microsoft.Azure.Commands.Batch.Models.PSComputeNodeInformation

Constraints : Microsoft.Azure.Commands.Batch.Models.PSTaskConstraints

CreationTime : 3/24/2015 10:21:51 PM

EnvironmentSettings :

ETag : 0x8D295483E08BD9D

ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSTaskExecutionInformation

Id : Task27

LastModified : 3/24/2015 10:23:35 PM

PreviousState : Running

PreviousStateTransitionTime : 3/24/2015 10:23:37 PM

ResourceFiles :

RunElevated : True

State : Completed

StateTransitionTime : 3/24/2015 10:23:37 PM

Statistics :

Url : https://pfuller.westus.batch.azure.com/ ... sks/Task27



This command gets the completed tasks from the job that has the ID Job02.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ebatchtask

Get-AzureRmBatchAccountKeys

Get-AzureBatchJob

New-AzureBatchTask

Remove-AzureBatchTask

Stop-AzureBatchTask

Azure Batch Cmdlets