Powershell script to check last VM backup

Azure-learning 56 Reputation points
2022-09-12T13:47:52.893+00:00

We need to check the Azure VM backup status (Snapshot only) is successful or failed for the last backup job/latest backup that ran same day or few hours back.

Can you please help with the powershell script to check the last run status that is done same day.

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 129.4K Reputation points MVP Volunteer Moderator
    2022-09-12T14:16:04.523+00:00

    Hi @NGaur-3476 ,

    maybe this helps to get started:

    foreach ($RecoveryServicesVault in Get-AzRecoveryServicesvault) {  
        Get-AzRecoveryServicesBackupJob -VaultID $RecoveryServicesVault.ID -Operation "Backup" -From ((Get-Date).AddDays(-1).ToUniversalTime()) |  
        Select-Object WorkloadName,Operation,Status,StartTime,EndTime,Duration  
        }  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.