This assumes you're using the option in Veeam jobs to add a note to the VM with the last backup status.
Code: Select all
$VMwareNoteProperyName = "VeeamBackupStatus"
get-vm | get-annotation -name "VeeamBackupStatus" | select annotatedentity, @{n="LastBackupTime";e={[Datetime]($_.value -replace '.*Time: \[(.*?)\].*','$1')}}
Taking it further, get all snapshots from powered on VMs that are older than 7 days and also report their last backup time:
Code: Select all
$days =7
$datacenter = "my datacenter"
get-datacenter $datacenter | get-vm | where powerstate -match 'PoweredOn' | get-snapshot | where created -lt (get-date).adddays(-$days) | select VM,Name,Description,created,sizeGB,@{n="VMLastBackedUp";e={[DateTime]((get-vm $_.vm | get-annotation -name VeeamBackupStatus) -replace '.*Time: \[(.*?)\].*','$1')}} | sort created | export-csv -NoTypeInformation "$home\desktop\VMSnapshotsOlderThan${Days}DaysReport-$(get-date -format yyyyMMdd).csv"