Modify the repeat time of replicas

PowerShell script exchange

Modify the repeat time of replicas

Veeam Logoby jmcelvoy » Tue Sep 17, 2013 4:16 pm

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?
jmcelvoy
Novice
 
Posts: 7
Liked: never
Joined: Wed Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy

Re: Modify the repeat time of replicas

Veeam Logoby v.Eremin » Tue Sep 17, 2013 4:20 pm

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.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Modify the repeat time of replicas

Veeam Logoby jmcelvoy » Tue Sep 17, 2013 7:13 pm

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?
jmcelvoy
Novice
 
Posts: 7
Liked: never
Joined: Wed Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy

Re: Modify the repeat time of replicas

Veeam Logoby tsightler » Tue Sep 17, 2013 7:27 pm

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
}
tsightler
Veeam Software
 
Posts: 4767
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Modify the repeat time of replicas

Veeam Logoby jmcelvoy » Tue Sep 17, 2013 7:31 pm

Thanks. Just what I needed.
jmcelvoy
Novice
 
Posts: 7
Liked: never
Joined: Wed Mar 14, 2012 9:34 pm
Full Name: Jason McElvoy

Re: Modify the repeat time of replicas

Veeam Logoby v.Eremin » Wed Sep 18, 2013 8:13 am

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.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests