Get-​Azure​Rm​Recovery​Services​Backup​Job

Gets Backup jobs.

Syntax

Get-AzureRmRecoveryServicesBackupJob
   [[-Status] <JobStatus>]
   [[-Operation] <JobOperation>]
   [[-From] <DateTime>]
   [[-To] <DateTime>]
   [[-JobId] <String>]
   [[-Job] <JobBase>]
   [-BackupManagementType <BackupManagementType>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Get-AzureRmRecoveryServicesBackupJob cmdlet gets Azure Backup jobs for a specific vault.

Set the vault context by using the Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.

Examples

Example 1: Get all in-progress jobs

PS C:\>$Joblist = Get-AzureRMRecoveryservicesBackupJob -Status Inprogress
PS C:\> $Joblist[0]
WorkloadName     Operation            Status               StartTime                 EndTime                                             
------------     ---------            ------               ---------                 -------                                             
V2VM             Backup               InProgress           4/23/2016 5:00:30 PM      1/1/2001 12:00:00

The first command gets status of an in-progress job as an array, and then stores it in the $Joblist variable.

The second command displays the first item in the $Joblist array.

Example 2: Get all failed jobs in the last 7 days

PS C:\>Get-AzureRmRecoveryServicesBackupJob -From (Get-Date).AddDays(-7).ToUniversalTime() -Status Failed

This command gets failed jobs from the last week in the vault. The From parameter specifies a time seven days in the past specified in UTC. The command does not specify a value for the To parameter. Therefore, it uses the default value of the current time.

Example 3: Get an in-progress job and wait for completion

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

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

Optional Parameters

-BackupManagementType

Specifies the Backup management type. Currently, only AzureVM is supported.

Type:BackupManagementType
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-From

Specifies the start, as a DateTime object, of a time range for the jobs that this cmdlet gets. To obtain a DateTime object, use the Get-Date cmdlet. For more information about DateTime objects, type Get-Help Get-Date. Use UTC format for dates.

Type:DateTime
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Job

Specifies the name of the Backup job to get.

Type:JobBase
Position:6
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-JobId

Specifies the ID of a job that this cmdlet gets. The ID is the InstanceId property of an AzureRmRecoveryServicesBackupJob object. To obtain an AzureRmRecoveryServicesBackupJob object, use Get-AzureRmRecoveryServicesBackupJob.

Type:String
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Operation

Specifies an operation of the jobs that this cmdlet gets. The acceptable values for this parameter are:- Backup

  • ConfigureBackup
  • DeleteBackupData
  • Register
  • Restore
  • UnProtect
  • Unregister
Type:JobOperation
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Status

Specifies a status of the jobs that this cmdlet gets. The acceptable values for this parameter are:- InProgress

  • Failed
  • Cancelled
  • Cancelling
  • Completed
  • CompletedWithWarnings
Type:JobStatus
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-To

Specifies the end, as a DateTime object, of a time range for the jobs that this cmdlet gets. The default value is the current system time. If you specify this parameter, you must also specify the From parameter. Use UTC format for dates.

Type:DateTime
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False