PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 820
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Get-VBRUnstructuredBackupCopyJob Schedule

Post by matteu »

Hello,

How is it possible with this cmdlet to get the schedule value ?
This one : Secondary copy settings : Data can be copied to this repository Any time / During the following time periods only

Thanks
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get-VBRUnstructuredBackupCopyJob Schedule

Post by oleg.feoktistov »

You can determine it by the following property:

Code: Select all

(Get-VBRUnstructuredBackupJob).SecondaryTarget.BackupWindowEnabled
Best regards,
Oleg
matteu
Veeam Legend
Posts: 820
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Get-VBRUnstructuredBackupCopyJob Schedule

Post by matteu »

Thanks,
It works perfectly.
I use it with this :

Code: Select all

function Get-VeeamBackupCopyNAS
{
    Write-host "$(Get-Date -Format HH:mm:ss) - NAS backup copy jobs"

    $NASBackupCopyJobsReq = Get-VBRUnstructuredBackupCopyJob
    foreach ($element in $NASBackupCopyJobsReq)
    {
        $Source = Get-VBRUnstructuredBackupJob -Id $element.LinkedJobIds.Guid
        $Retention = if ($element.Options.NasBackupRetentionPolicy.UseSpecificRetentionPolicy)
        {
            $element.Options.NasBackupRetentionPolicy.ShortTermRetention + " " + $element.Options.NasBackupRetentionPolicy.ShortTermRetentionUnit
        }
        else
        {
            $Source.ShortTermRetentionPeriod + " " + $source.ShortTermRetentionType
        }
        [pscustomobject]@{
            Name            = $element.Name
            Source          = $Source.name
            Target          = (Get-VBRBackupRepository | Where-Object {$_.Id -eq $element.TargetRepositoryId.Guid}).Name
            Retention       = $Retention
            Encryption      = $element.BackupStorageOptions.UseSpecificStorageEncryption
            Schedule        = if ($Source.SecondaryTarget.BackupWindowEnabled) {"Continuously"} else {"A renseigner manuellement"}
        }
        Write-Host "$(Get-Date -Format HH:mm:ss) --------------------"
    }
}
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests