I've made some progress using helpful bits gathered from here on the forums, gathering the sobr offload jobs:
Code: Select all
$sobrOffload = [Veeam.Backup.Model.EDbJobType]::ArchiveBackup #This type corresponds to SOBR Offload job
$recentOffloadJobs = [Veeam.Backup.Core.CBackupSession]::GetByTypeAndTimeInterval($sobrOffload,(Get-Date).adddays(-30), (Get-Date).adddays(1)) | Sort-Object CreationTimeUTC -Descending
Code: Select all
$sobrCopyModeRepos = Get-VBRBackupRepository -ScaleOut | Where-Object { $_.CapacityTierCopyPolicyEnabled }
$sobrRestorePoints = Get-VBRRestorePoint | Where-Object {
try {
$sobrCopyModeRepos.id -contains $_.GetRepository().id
} catch {
# Some restore points don't have a repository set and will cause Exceptions when GetRepository is called.
# We don't want them anyway...
$false
}
}
$BackupVMs = $sobrRestorePoints | Select-Object -expand VMName -Unique
foreach ($bvm in $BackupVMs) {
# Get Backup ObjectID
$bvmObjID = $sobrRestorePoints | Where-Object {
$_.VMName -eq $bvm -and `
$_.isConsistent
} | Select-Object -ExpandProperty ObjectID -Unique
# Get SOBR Offload Tasks for Backup Object ID (VM/Agent/Whatever)
# Because these are reverse sorted by time in '00 Veeam Initialization' (Newest First) We can just hunt for the first successful task session that transferred data
foreach ($oJob in $recentOffloadJobs) {
$oJobTask = $oJob.FindTaskSessionByObjectId($bvmObjID)
if ($null -ne $oJobTask -and $oJobTask.progress.transferedSize -gt 0) {
#Process
}
}
}