Waits for a Backup job to finish.


    [-Job] <Object>
    [[-Timeout] <Int64>]


The Wait-AzureRmRecoveryServicesBackupJob 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 Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.


Example 1: Wait for a job to finish

PS C:\>
$Jobs = Get-AzureRmRecoveryServicesBackupJob -Status InProgress
    $Job = $Jobs[0]
    while ( $Job.Status -ne Completed )
       Write-Host "Waiting for completion..."
       Start-Sleep -Seconds 10
       $Job = Get-AzureRmBackAzureRmRecoveryServicesBackupJob -Job $Job
   Write-Host "Done!"
    Waiting for completion... 
    Waiting for completion... 
    Waiting for completion... 

This script polls the first job that is currently in progress until the job has completed.

Required Parameters


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

Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters


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

Default value:None
Accept pipeline input:False
Accept wildcard characters:False