PowerShell script exchange
Post Reply
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

Get Job Schedule Status thru powershell?

Post by ThierryF »

Hello,

Using VBR9.5U3, I am trying to extract my jobs and their schedule (type and enabled/disabled scheduling).
Schedule type may be Daily, Monthly or Periodically but can also be depending of
the completion of a previous job.

Using get-vbrjob, I can retrieve settings :
$testjob=Get-VBRJobOptions -job "Test Backup"
$testjob.ScheduleOptions

I can retrieve enabled Daily/Monthly/Periodically job schedule options or
id of depending job using $testjob.ParentScheduleId if any. Great.

Thru console, I can edit job and set/unset "run job automatically".
Thru powershell, I can enable or disable job but
unfortunately, I cannot retrieve if job is enabled or not ...

Any idea ?

Thanks !

TH
Lucas_H
Influencer
Posts: 17
Liked: 4 times
Joined: Nov 16, 2018 3:14 pm
Full Name: Lucas HELLMANN
Location: Lyon, FRANCE
Contact:

Re: Get Job Schedule Status thru powershell?

Post by Lucas_H »

Hello,

Does this command found on this thread powershell-f26/check-back-copy-job-is-d ... 34787.html would help ?

Code: Select all

Get-VBRJob | where {$_.IsScheduleEnabled -eq $False} | select name
Cheers,
Lucas H
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF »

Hello,

I gave a check but for all of my unscheduled backup jobs,
the flag IsScheduleEnabled equals True :-(

Bug ?

Thanks !
TH
Lucas_H
Influencer
Posts: 17
Liked: 4 times
Joined: Nov 16, 2018 3:14 pm
Full Name: Lucas HELLMANN
Location: Lyon, FRANCE
Contact:

Re: Get Job Schedule Status thru powershell?

Post by Lucas_H »

Hello,

As I only had scheduled or disabled job I created an unschedule test Job, it also didn't appear when I tried the code, it has the ScheduleEnabled to true too. That seems strange yes.
Even when the GUI shows no Next Run, with powershell I see the Next Run in ScheduleOptions with the value corresponding to the right time if Next Run was enabled.
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF »

For what I can see, IsScheduleEnabled is turned True/False depending if job is enabled or disabled
but nothing regarding Scheduled or not (flag run the job automatically from Job -> Schedule pane)

Th
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Job Schedule Status thru powershell?

Post by veremin » 2 people like this post

Check the following property (it should show $False for a job with enabled schedule):

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Job.Options.JobOptions.RunManually
Thanks!
ThierryF
Expert
Posts: 129
Liked: 33 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF »

Great ! Thanks !!! lol

Have a nice week-end !

Th
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Job Schedule Status thru powershell?

Post by veremin » 1 person likes this post

You too. Should other questions arise, don't hesitate to reach us. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests