WARNING: There is a minor flaw in that synthetic full backups count as full backups, even if the VM hasn't been backed up from the source. I'm working on the best way to filter those out in a simple manner.
Prerequisites
These assume Powershell v3 or later, and you have the veeam snapin running.
Code: Select all
Add-PSSnapin veeampssnapin -registered
Code: Select all
install-module vmware.powercli -scope currentuser;connect-viserver
Code: Select all
etsn mybackupserver1
Code: Select all
Get-VBRRestorePoint | where type -notmatch 'Snapshot' | where isConsistent | group name | sort name | foreach {$PSItem | % Group | sort creationtime -descending | select -first 1 name,type,creationtime}
This one is handy if you set up as a daily or hourly check and have it mail you the results
Code: Select all
Get-VBRRestorePoint | where type -notmatch 'Snapshot' | group name | sort name | foreach {$PSItem | % Group | sort creationtime -descending | select -first 1 name,type,creationtime} | where creationtime -lt (get-date).adddays(-3)
Note: We tried to "filter left" on this one and only retrieve restore points on a per-VM basis, but the Veeam per-VM queries take forever, much faster to just get all restore points up front and have Powershell do the filtering work. If you have a massive infrastructure (50k+ restore points I guess) you may need more memory to run this script but it should work fine)
Code: Select all
$RPs = get-vbrrestorepoint | where isconsistent;get-vm | where powerstate -match 'PoweredOn' | sort name | foreach {$RPItem = $RPs | where vmname -match $PSItem.name | sort creationtime -descending | select -first 1 name,type,creationtime; if ($RPItem) {$RPItem} else {[PSCustomObject]@{Name=$PSItem.Name;Type="NOTBACKEDUP";CreationTime="NOTBACKEDUP"}}}
Get Powered On VMs in vCenter that have not been backed up in the last 3 days (assumes PowerCLI)
Code: Select all
$RPs = get-vbrrestorepoint | where isconsistent;get-vm | where powerstate -match 'PoweredOn' |sort name | foreach {$RPItem = $RPs | where vmname -match $PSItem.name | sort creationtime -descending | select -first 1 name,type,creationtime; if ($RPItem) {$RPItem} else {[PSCustomObject]@{Name=$PSItem.Name;Type="NOTBACKEDUP";CreationTime="NOTBACKEDUP"}}} | where {$PSItem.creationtime -lt (get-date).adddays(-3) -or $PSItem.type -match 'NOTBACKEDUP'}