Get-AzureRmRecoveryServicesBackupJob
Gets Backup jobs.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Get-AzureRmRecoveryServicesBackupJob
[[-Status] <JobStatus>]
[[-Operation] <JobOperation>]
[[-From] <DateTime>]
[[-To] <DateTime>]
[[-JobId] <String>]
[[-Job] <JobBase>]
[-BackupManagementType <BackupManagementType>]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[<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.
Parameters
-BackupManagementType
Specifies the Backup management type. Currently, only AzureVM, AzureStorage is supported.
Type: | Nullable<T>[BackupManagementType] |
Accepted values: | AzureVM, MARS, SCDPM, AzureBackupServer, AzureSQL, AzureStorage |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
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: | Nullable<T>[DateTime] |
Position: | 3 |
Default value: | None |
Required: | False |
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 |
Required: | False |
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 |
Required: | False |
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: | Nullable<T>[JobOperation] |
Accepted values: | Backup, Restore, ConfigureBackup, DisableBackup, DeleteBackupData |
Position: | 2 |
Default value: | None |
Required: | False |
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: | Nullable<T>[JobStatus] |
Accepted values: | InProgress, Cancelling, Cancelled, Completed, CompletedWithWarnings, Failed |
Position: | 1 |
Default value: | None |
Required: | False |
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: | Nullable<T>[DateTime] |
Position: | 4 |
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
Parameters: VaultId (ByValue)