Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

How can you set the schedule using Set-BEDuplicateStageBackupTask

Created: 18 Oct 2013 • Updated: 28 Oct 2013 | 12 comments
This issue has been solved. See solution.

I would like to script out the ability to set the run time for some of my duplicate stages. Here is a simple script on what I am trying to accomplish

$Def = Get-BEBackupDefinition -Name "JobName"
$Time = Get-Date -Day 1 -Month 11 -Hour 5 -Minute 00 -Second 00
$Schedule = New-BESchedule -MonthlyEvery First -Day Day -StartingAt $Time -Every 1
Set-BEDuplicateStageBackupTask -Name * -BackupDefinition $Def -Schedule $Schedule | Save-BEBackupDefinition

However, when the script runs I receive the following error:

Set-BEDuplicateStageBackupTask : Parameter set cannot be resolved using the specified named parameters.
At line:5 char:1
+ Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" -BackupDefinition $De ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-BEDuplicateStageBackupTask], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,BackupExec.Management.CLI.Commands.SetBEDuplicateStageBackupTaskCommand

How would one use the Set-BEDuplicateStageBackupTask to modify the schedule of a job?

Operating Systems:

Comments 12 CommentsJump to latest comment

pkh's picture

I would suggest that you use this

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name * -Schedule $Schedule | Save-BEBackupDefinition

brholmes's picture

Hi pkh,

Thanks for the suggestion, but I still received the same error.

pkh's picture

Do you really have a backup definition called JobName?  If not then you should use

Get-BEJobDefinition

to get all the job definitions and then use

Get-BEJobDefinition -name "xxxx"

to get the job definition that you want.

brholmes's picture

No, the job name is not "Job Name." I am just using that as an example. Set-BEDuplicateStageBackupTask seems to break when I use the schedule switch.

I can run Set-BEDuplicateStageBackupTask -Name * -BackupDefinition $Def -Schedule and it works, but it does not change the job schedule.

pkh's picture

Have you tried using the stage name in the -name parameter rather than *

brholmes's picture

That still does not work. The issue appears to only be present when I try to modify the duplication task's schedule.

Works:

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" | Save-BEBackupDefinition
Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "*" | Save-BEBackupDefinition

Does not work:

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" -Schedule $Schedule | Save-BEBackupDefinition

pkh's picture

I have done some testing and can confirm what you are seeing.  I too think there is a bug in in the schedule parameter.

Perhaps you would like to log a support case, report the problem and see what tech support got to say.

BE_KirkFreiheit's picture

Hi brholmes and pkh,

Great question -- hope the following helps:

Background

DuplicateStageTasks have both a source (backup or duplicate stage) and schedule (time-based or immediately after).

For backup sources, you also have the choice of "All", "Most recent full", and "Specific Backups".

Problem

This is an issue with the parameter sets we shipped for the Set-BEDuplicateStageBackupTask cmdlet.

They are the same as the New-BEDuplicateStageBackupTask, but your example usage reveals a design error.  Fortunately, there is a workaround.

Workaround

The source-related parameters must always be given because they're required parameters in the various parameter sets (i.e. multiple syntaxes) that Set-BEDuplicateStageBackupTask supports.

Examples

$Time = Get-Date -Day 1 -Month 11 -Hour 5 -Minute 00 -Second 00
$Schedule = New-BESchedule -MonthlyEvery First -Day Day -StartingAt $Time -Every 1

# If you're duplicating all backups in "Monthly Tape Backup":

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" -Schedule $Schedule -SourceBackup AllBackups | Save-BEBackupDefinition

# If you're duplicating the most recent full in "Monthly Tape Backup":

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" -Schedule $Schedule -SourceBackup MostRecentFullBackup | Save-BEBackupDefinition

# If you're duplicating a backup task called "Full" in "Monthly Tape Backup":

Get-BEBackupDefinition -Name "JobName" | Set-BEDuplicateStageBackupTask -Name "Monthly Tape Backup" -Schedule $Schedule -SourceBackup SpecificSourceBackups -SpecificSourceBackup Full | Save-BEBackupDefinition

Discussion

It's not ideal, because you need to re-set the -SourceBackup and (if necessary) -SpecificSourceBackup parameters to their current values (otherwise you'll change the inputs to your duplicate task!)

Hope this helps you get over the hump -- I'll see what I can do to get this changed/fixed in an upcoming release.

Question

One question for you: say you tried applying this change to "*" duplicate tasks in a backup definition, and one of them currently had an "ImmediatelyAfter" schedule.  What would you expect the following line to do:

Get-BEBackupDefinition -name "JobName" | Set-BEDuplicateStageBackupTask -Name "*" -Schedule (New-BEBackupSchedule -Weekly -Every 1 -StartingAt 11pm) | Save-BEBackupDefinition -confirm:$false

a) Change the schedule to time-based, with a -SpecificSourceBackup of the task it previously duplicated "ImmediatelyAfter"
b) Write an error, and require that -Force is specified (because changing from immedately after to time-based schedule is a bit radical, so it would be good to draw attention to the change)
c) Write a warning, but otherwise the same as option "a" above
d) Something else?

brholmes's picture

I called Symantec tech support and they informed me that this is a bug and will hopefully be corrected in a future release.

SOLUTION
brholmes's picture

HI Kirk,

I would expect it to write a warning letting you know that you cannot change an "ImmediatelyAfter" to a time-based schedule and still complete the actions on all of the other jobs that meet the requirements.

I suppose if you used the -Force switch, then yes it would force all jobs (if useing "*") to a time-based schedule. Maybe with a notification letting you know that you just changed the "ImmediatelyAfter" to a time-based job. Similar to how the New-BEBackupDefintion displays the results in an orange text color when it is not saved.

Thats just my opinion though

BE_KirkFreiheit's picture

Thanks for the feedback.  We try to balance the "PowerShelliness" of the cmdlet interfaces with usabiliy, and sometimes things go a bit overboard.

Parameter sets are a great tool that PowerShell itself gives to both users and developers, but sometimes it's better to validate inside the code of a cmdlet -- this (setting just the -Schedule) is one of those instances where we could have made usability better by simplifiying the syntax but complicating our own internal logic.

At the end of the day, the goal is to make understandable and easily used cmdlets so you can solve your problems effectively and efficiently -- your opinion definitely matters!

Thanks again; would the workaround above help you out -- or do your duplicate stages have a wide variety of "-SourceBackup" styles?  I was hoping you have a 'typical' duplication strategy across your backup definitions and could maybe get some relief with the extra parameters.  Any chance it might help out?

brholmes's picture

Hi Kirk,

Yes, using the "-SourceBackup" switch would have worked in my case. For this paticular instance I have a very simple backup strategy, however, I have multiple servers to change the date/time on. Which is what I originally set out to do.

The cmdlet itself works fine, I think that the switch dependencies need to be better defined. The error that is being displayed does not lead you to believe that a SourceBackup needs to be defined for the schedule switch to work.

Thanks for you help.