PowerShell script exchange
Post Reply
ThierryF
Enthusiast
Posts: 37
Liked: 11 times
Joined: Mar 31, 2018 10:20 am
Contact:

Get Job Schedule Status thru powershell?

Post by ThierryF » Feb 01, 2019 8:03 am

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 » Feb 01, 2019 8:34 am

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
Enthusiast
Posts: 37
Liked: 11 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF » Feb 01, 2019 9:22 am

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 » Feb 01, 2019 10:01 am

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
Enthusiast
Posts: 37
Liked: 11 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF » Feb 01, 2019 10:46 am

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: 16710
Liked: 1396 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Job Schedule Status thru powershell?

Post by veremin » Feb 01, 2019 3:24 pm 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
Enthusiast
Posts: 37
Liked: 11 times
Joined: Mar 31, 2018 10:20 am
Contact:

Re: Get Job Schedule Status thru powershell?

Post by ThierryF » Feb 01, 2019 3:45 pm

Great ! Thanks !!! lol

Have a nice week-end !

Th

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

Re: Get Job Schedule Status thru powershell?

Post by veremin » Feb 01, 2019 4:19 pm 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 2 guests