I'm looking for the proper way to retrieve my Backup Jobs' Target Repositories Names.
While I get some settings through the job's options, it seems more complicated to retrieve this information.
I thought the TargetDir property would be enough but it's not always filled it seems, and returns the path associated with the repository when I get something.
Code: Select all
ForEach($BackupCopyJob in (Get-VBRJob | ? {$_.JobType -eq "BackupSync"} | Sort-Object Name)){
$Options = $BackupCopyJob.GetOptions()
$Properties = New-Object Psobject
$Properties | Add-Member -type Noteproperty -name JobName -value $BackupCopyJob.Name
$Properties | Add-Member -type Noteproperty -name Description -value $BackupCopyJob.NameWithDescription
$Properties | Add-Member -type Noteproperty -name IsScheduledEnabled -value $BackupCopyJob.IsScheduleEnabled
$Properties | Add-Member -type Noteproperty -name RestorePointsToKeep -value $Options.generationpolicy.SimpleRetentionRestorePoints
$Properties | Add-Member -type Noteproperty -name GFSMonthlyBackups -value $Options.generationpolicy.GFSMonthlyBackups
$Properties | Add-Member -type Noteproperty -name GFSYearlyBackups -value $Options.generationpolicy.GFSYearlyBackups
$Properties | Add-Member -type Noteproperty -name RetentionPolicyType -value $Options.generationpolicy.RetentionPolicyType
$Properties | Add-Member -type Noteproperty -name Path -value $BackupCopyJob.TargetDir
Write-Output $Properties
}