PowerShell script exchange
Post Reply
jmcelvoy
Novice
Posts: 7
Liked: never
Joined: Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy
Contact:

Modify the repeat time of replicas

Post by jmcelvoy »

In working with Veeam support, I need to back off how frequently I have my replica jobs running. Right now they run ever 1-2 hours. I'd like to start with every 4 hours to see if it improves performance. I can see in ScheduleOptions there are options for RepeatNumber and RepeatTimeUnit. I think I simply need to modify the RepeatNumber for all my jobs. The tech I was on the phone with couldn't quickly figure it out so I figured I'd ask here. How can I modify all replica jobs to repeat ever 4 hours?
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify the repeat time of replicas

Post by veremin »

Hi, Jason.

In the way I see it, the following script should answer your requirements:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBrJob -name "Name of replication Job"
$ScheduleOptions = $Job.GetScheduleOptions()
$ScheduleOptions.OptionsPeriodically.FullPeriod = "240"
Set-VBRJobScheduleOptions -Job $Job -Options $ScheduleOptions 
Or you're willing to modify the settings of every replication job you have in your environment?

Thanks.
jmcelvoy
Novice
Posts: 7
Liked: never
Joined: Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy
Contact:

Re: Modify the repeat time of replicas

Post by jmcelvoy »

Thanks, that does work.
If I wanted to do every replication job at the same time, how would I achieve that? I took out the -name part of the script and placed a * in there and for some reason it changed 1 random job. Can you not use wildcards?
tsightler
VP, Product Management
Posts: 6011
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Modify the repeat time of replicas

Post by tsightler »

If you try to do that then $Jobs will hold and array of job objects so whichever one was first in the list will be the one changed. To change all of them you'd need to add a loop to cycle through every job in the array, something like this (untested, but I think it's right):

Code: Select all

asnp VeeamPSSnapin
$Jobs = Get-VBRJob -Name "*"
for ($Job in $Jobs) {
   $ScheduleOptions = $Job.GetScheduleOptions()
   $ScheduleOptions.OptionsPeriodically.FullPeriod = "240"
   Set-VBRJobScheduleOptions -Job $Job -Options $ScheduleOptions
}
jmcelvoy
Novice
Posts: 7
Liked: never
Joined: Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy
Contact:

Re: Modify the repeat time of replicas

Post by jmcelvoy »

Thanks. Just what I needed.
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify the repeat time of replicas

Post by veremin »

I believe, the missing part is that script provided above doesn’t have any distinguishing mechanism between replication and backup jobs. In other words, it does change settings of both backup and replication jobs. So, if you’re willing to apply changes only to replication ones, you should change the script slightly:

Code: Select all

asnp VeeamPSSnapin
Foreach ($Job in (Get-VBRJob | where {$_.Jobtype -eq "Replica"}))
{
   $ScheduleOptions = $Job.GetScheduleOptions()
   $ScheduleOptions.OptionsPeriodically.FullPeriod = "240"
   Set-VBRJobScheduleOptions -Job $Job -Options $ScheduleOptions
} 
Hope this helps.
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests