PowerShell script exchange
Post Reply
AlexL
Service Provider
Posts: 136
Liked: 13 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

set backup window for backup copy job

Post by AlexL »

Just been struggling a while to set a backup window for a backup copy job. This might help anyone else having the issues with this.

In the documentation (https://helpcenter.veeam.com/docs/vbr/p ... pyjob.html), the text for -Anytime is either wrong or misleading at best.
It seems to be a Boolean not a Switch as described in the parameters table. With a switch parameter you would assume that not using it will do A and using it will do B.

This does not seem to be the case here. You must use explicitly -Anytime:$False to enable the backup window you can supply with -BackupWindowOptions

So, you would expect this (as the example suggest):

$job = Get-VBRBackupCopyJob -Name "Copy Job05"
$windowoptions = New-VBRBackupWindowOptions -FromDay Monday -FromHour 08 -ToDay Friday -ToHour 20
Set-VBRBackupCopyJob -Job $job -BackupWindowOptions $windowoptions

The above lines are NOT fully functional, you ALSO need to do -Anytime:$False, so a complete example would be:

$job = Get-VBRBackupCopyJob -Name "Copy Job05"
$windowoptions = New-VBRBackupWindowOptions -FromDay Monday -FromHour 08 -ToDay Friday -ToHour 20
Set-VBRBackupCopyJob -Job $job -Anytime:$False
Set-VBRBackupCopyJob -Job $job -BackupWindowOptions $windowoptions

And unfortunately, you cannot use -Anytime:$False together with -BackupWindowOptions.

I believe this to be a bug, expected behavior would be:

Set-VBRBackupCopyJob -Job $job -Anytime <- disable backup window, so the job runs 24/7
Set-VBRBackupCopyJob -Job $job -BackupWindowOptions $windowoptions <- enable & set the backup window

As explained above, you can work around this bug but then the documentation should be clearer as I suggested in my example.

Regards,
Alex
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests