Script to show last successful Veeam backup of VMs

Script to show last successful Veeam backup of VMs

Here is a small and simple PowerShell script to list VMs, their last successful backup and the days gone since then.

Add-PSSnapin VeeamPSSnapin
Connect-VBRServer -Server Backup_Server
$today = Get-Date
$vbrrestore = get-vbrbackup | Get-VBRRestorePoint | sort vmname,CreationTime | select vmname, creationtime , @{n='Days since last success'; e={(New-TimeSpan -Start $_.creationtime -End $today).days}} | group vmname
$vbrrestore | foreach {$ | select -last 1} | ft -AutoSize

9 responses to “Script to show last successful Veeam backup of VMs”

  1. Thomas B says:

    Please could you help me. Do you know how to filter this to get only Veeam Agent backup jobs for Windows computers? Thanks

    • woifgaung says:

      I didn’t need this up to now. But you can filter by Job-Name in cmdlet get-vbrbackup, or you can probably use Get-VBREPJob instead, that should be for agent-backup only.

  2. Thomas B says:

    One more question please : How to exclude computer/vm included in disabled jobs? Thanks for your help

  3. Thomas B says:

    Ah ok, I didn’t have answer so I was afraid that something appened to you 😉

    Thanks for your answers

  4. Oskar says:

    I don’t think this distinguish between successful and incomplete restore points, so the result could be misleading. All of them are returned by Get-VBRRestorePoint. There are properties IsCorrupted and IsConsistent on the snapshot that seem to be related do this. I don’t know the difference between them – perhaps one is just the inverse of the other for convenience.

    • vNote42 says:

      Good point, Oskar! Script is quite old (2017), so I do not know what was possible than. But you are right, would be a good idea to query this properties as well!

Leave a Reply

Your email address will not be published. Required fields are marked *