PowerShell script exchange
Post Reply
BHB3805
Enthusiast
Posts: 33
Liked: 1 time
Joined: Nov 04, 2011 1:45 pm
Full Name: Dan Andryszak
Contact:

Script to list Target Destination for Replica Job

Post by BHB3805 »

I am trying to get the destination for my replica jobs, but the script returns "Default Backup Repository".
Any idea what I'm missing?

Code: Select all

ForEach($BackupCopyJob in (Get-VBRJob | ? {$_.JobType -eq "Replica"} | Sort-Object Name)){
     $Options = $BackupCopyJob.GetOptions()
     $Properties = New-Object Psobject
     $Properties | Add-Member -type Noteproperty -name "Job Name" -value $BackupCopyJob.Name
     $Properties | Add-Member -type Noteproperty -name Description -value $BackupCopyJob.NameWithDescription
     $Properties | Add-Member -type Noteproperty -name Scheduled -value $BackupCopyJob.IsScheduleEnabled
     $Properties | Add-Member -type Noteproperty -name "Restore Points" -value $Options.generationpolicy.SimpleRetentionRestorePoints
     $Properties | Add-Member -type Noteproperty -name "Retention Policy" -value $Options.generationpolicy.RetentionPolicyType
    [color=#FF0000] $Properties | Add-Member -type Noteproperty -name Path -value $BackupCopyJob.GetTargetRepository().Name[/color]
     Write-Output $Properties
}
ronnmartin61
Veeam Software
Posts: 540
Liked: 193 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: Script to list Target Destination for Replica Job

Post by ronnmartin61 »

Yes looks like that's returning the Veeam repo where the replica job metadata is stored. I think you want -

Code: Select all

$Properties | Add-Member -type Noteproperty -name Path -value $BackupCopyJob.ViReplicaTargetOptions.DatastoreName
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests