Editar

Compartilhar via


Wait-AzRecoveryServicesBackupJob

Waits for a Backup job to finish.

Syntax

Wait-AzRecoveryServicesBackupJob
    [-Job] <Object>
    [[-Timeout] <Int64>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Wait-AzRecoveryServicesBackupJob cmdlet waits for an Azure Backup job to finish. Backup jobs can take a long time. If you run a backup job as part of a script, you may want to force the script to wait for job to finish before it continues to other tasks. A script that includes this cmdlet can be simpler than one that polls the Backup service for the job status. Set the vault context by using the -VaultId parameter.

Examples

Example 1: Wait for a job to finish

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Jobs = Get-AzRecoveryServicesBackupJob -Status InProgress -VaultId $vault.ID
Wait-AzRecoveryServicesBackupJob -Job $Jobs[0] -VaultId $vault.ID -Timeout 3600

This script polls the first job that is currently in progress until the job has completed or timeout period of 1 hour expired.

Parameters

-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

-Job

Specifies the job to wait for. To obtain a BackupJob object, use the Get-AzRecoveryServicesBackupJob cmdlet.

Type:Object
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Timeout

Specifies the maximum time, in seconds, that this cmdlet waits for the job to finish. It is recommended to specify a time-out value.

Type:Nullable<T>[Int64]
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VaultId

ARM ID of the Recovery Services Vault.

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

Inputs

Object

String

Outputs

JobBase