PowerShell script exchange
Post Reply
ArnaudK
Novice
Posts: 5
Liked: never
Joined: Sep 05, 2013 10:16 am
Full Name: Arnaud K
Contact:

SetScheduleDependentJobs VEEAM 7.0

Post by ArnaudK »

Hi!

I Just have little problem for scripting jobs:
$Job1 = Get-VBRJob -name $JobName
$Job2 = Get-VBRJob -name $SecondJobName
$Job2.SetScheduleDependentJobs($Job1)
Result : Job1 After Job1!

And $Job1.SetScheduleDependentJobs($Job2)

Result : Job2 After Job2!

Any help please?
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

Hi, Arnaud. Seems like a GUI glitch or something; since if after running the said script you go to the schedule settings of a given job (Job2), the correct information will be shown (Job2 after Job1). Thanks.
ArnaudK
Novice
Posts: 5
Liked: never
Joined: Sep 05, 2013 10:16 am
Full Name: Arnaud K
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by ArnaudK »

Thank you for the answer, but I dont think so:

Image
ArnaudK
Novice
Posts: 5
Liked: never
Joined: Sep 05, 2013 10:16 am
Full Name: Arnaud K
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by ArnaudK »

Mmh, it's worst that i was thinking, my backup was launched at 22:00 !!!

Edit TEST Job:

Image

He display the first Job in my list and ask me to choose one if i want to click OK.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

It seems to be a bug, indeed. Though, the following script appears to work, as expected:

Code: Select all

Asnp VeeamPSSnapin
$Job1 = Get-VBRJob -name "Name of first job"
$Job2 = Get-VBRJob -name "Name of second job"
$Job2.SetScheduleDependentJobs($Job1)
Set-VBRJobSchedule -Job $Job1 -AfterJob $Job2 
Hope this helps.
Thanks.
ArnaudK
Novice
Posts: 5
Liked: never
Joined: Sep 05, 2013 10:16 am
Full Name: Arnaud K
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by ArnaudK »

Thanks!!!

Works perferctly!
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

You’re welcome. Feel free to contact us, should any other questions arise. Thanks.
Tobias_Elfstrom
Enthusiast
Posts: 84
Liked: 8 times
Joined: Jul 04, 2012 6:32 am
Full Name: Tobias Elfstrom
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by Tobias_Elfstrom »

v.Eremin wrote:It seems to be a bug, indeed. Though, the following script appears to work, as expected:

Code: Select all

Asnp VeeamPSSnapin
$Job1 = Get-VBRJob -name "Name of first job"
$Job2 = Get-VBRJob -name "Name of second job"
$Job2.SetScheduleDependentJobs($Job1)
Set-VBRJobSchedule -Job $Job1 -AfterJob $Job2 
Hope this helps.
Thanks.
In this example is $Job2 supposed to run after $Job1 ?
I can't seem to get this right...

I do this:

Code: Select all

$job = Get-VBRJob -Name $vmjobname
$tapejob = Get-VBRTapeJob -Name $tapejobname
# And set the schedule
$job.SetScheduleDependentJobs($tapejob)
Get-VBRTapeJob -Name $tapejobname |Set-VBRJobSchedule -After -AfterJob $job
Set-VBRJobSchedule -Job $tapejob -After -AfterJob $job
and I end up with this:
Image
Note that the "Next run" seems to be correct but it doesn't work and when you bring up the job it says Daily at 22:00
The use of two Set-VBRJobSchedule is just a try from my side that maybe setting it a second time would fix it....
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

In this example is $Job2 supposed to run after $Job1 ?
Actually, in the example provided above job1 should be run after job2. Though, the said script doesn’t seem to work in case of backup to tape jobs, only in case of normal backup ones. Thanks.
Tobias_Elfstrom
Enthusiast
Posts: 84
Liked: 8 times
Joined: Jul 04, 2012 6:32 am
Full Name: Tobias Elfstrom
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by Tobias_Elfstrom »

Ok. And just to be clear, it is a bug that you cant set the schedule of a tape-job with Set-VBRJobSchedule or should you use some other method?
BR Tobias
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

It appears to be a bug, indeed. As well as, the situation when you have to use two different methods (SetScheduleDependentJobs, Set-VBRJobSchedule) in order to set job schedule dependency. So, I will pass this information to development team later. Thanks.
Tobias_Elfstrom
Enthusiast
Posts: 84
Liked: 8 times
Joined: Jul 04, 2012 6:32 am
Full Name: Tobias Elfstrom
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by Tobias_Elfstrom »

Any of these fixed in patch01?
http://www.veeam.com/kb_articles.html/kb1823 says nothing about this.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

Nope, the issue with backup to tape job and .ScheduleDependentJob() hasn’t been resolved in the Patch#1. Thanks.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SetScheduleDependentJobs VEEAM 7.0

Post by veremin »

Though, in case of chaining common backup jobs, you don’t have to use two different commandlets, as has been suggested previously, since everything can be specified via Set-VBRJobScheduleOptions:

Code: Select all

asnp VeeamPssnapin
$Job = Get-VBRJob -name "Name of first backup job"
$Job2 = Get-VBRJob -name "Name of second backup job”
$ScheduleOptions = $Job.GetScheduleOptions()
$ScheduleOptions.OptionsScheduleAfterJob.IsEnabled = $True
$Job.options.JobOptions.RunManually = $False
Set-VBRJobScheduleOptions -Job $Job -Options $ScheduleOptions
Set-VBRJobSchedule -Job $Job -AfterJob $Job2

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests