PowerShell script exchange
Post Reply
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hey all,

I have a powershell script that gets jobs from Veeam and checks a number of things about them. One of these things is if the job is scheduled, not scheduled, or disabled.

However some job return commands, do not return the necessary information regarding scheduling/disabled:

Get-VBRTapeJob - Only returns if the job is enabled, this is false if disabled or not scheduled, is there anyway to make this distinction? I have used the command to view the scheduling options but there doesn't seem to be anything there to help.

Get-VBRComputerBackupCopyJob - Only has a "Next run" field, which is EMPTY if disabled or not scheduled, same question as with the GET-VBRTapeJob command.

Is there anyone who can help me out with this?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov » 1 person likes this post

Hi Theo,

In VBRBackupToTapeJob class there actually are corresponding properties for that:

Code: Select all

Get-VBRTapeJob | select Name, Enabled, @{n='ScheduleEnabled';e={$_.ScheduleOptions.Enabled}}
I am not sure though what kind of information you need about backup copy job scheduling. It is continuous no matter the copy mode: immediate or periodic. So, the notion of schedule being either enabled or disabled is not fully applicable here.
Please elaborate.

Thanks,
Oleg
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hi Oleg,

Thanks for the speedy reply! Unfortunately that doesn't solve my problem - a disabled job and a non-scheduled job both look the same from the output.

Disabled/NonScheduled jobs both return with Enabled - False, and a ScheduleEnabled - Blank
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

Theo,

Which VBR version you are using? I just tested in v11 and here are the scenarios I reproduced with tape jobs:

1. Job enabled, schedule enabled. PS: Enabled: true, ScheduleEnabled: true
2. Job enabled, schedule disabled. PS: Enabled: false, ScheduledEnabled: false
3. Job disabled, schedule enabled. PS: Enabled: false, ScheduleEnabled: true

As I see, you cannot have disabled tape job with disabled scheduling simultaneously, so these are the possible scenarios.
2nd point looks confusing though, so I passed it to QA. Meanwhile, to differentiate disabled and non-scheduled jobs you can use simple validation:

Code: Select all

$jobs = Get-VBRTapeJob
foreach($job in $jobs) {
    if ($job.Enabled -eq $false -and $job.ScheduleOPtions.Enabled -eq $false) {
        $enabled = $true
        $scheduleEnabled = $false
        
    }
    else {
      $enabled = $job.Enabled
      $scheduleEnabled = $job.ScheduleOptions.Enabled 
    }
    $Job | select Name, @{n='Enabled';e={$enabled}}, @{n='ScheduleEnabled';e={$scheduleEnabled}}
} 

Thanks,
Oleg
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hey Oleg,

Another speedy response! I'll look into this a bit more.

Would it make a difference between Backup to Tape, and File to Tape Backups?

Also, would I be able to see Enabled/Disabled and Scheduled for Windows Agent Backup Jobs?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

Since there is separate scheduling for full and incremental backups in FileToTape backup job, the properties to look for are $_.FullBackupPolicy.Enabled and $_.IncrementalBackupPolicy.Enabled. But yes, the algorithm is the same here.

For Windows Agent Backup Jobs it's a way simpler:

Code: Select all

Get-VBRComputerBackupJob | select Name, JobEnabled, ScheduleEnabled
No discrepancies here.

Thanks!
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hi Oleg,

That's brilliant!! Final questions - what about for Get-VBRComputerBackupCopyJob? I can only see a NextRun for this? Also for Get-VBRJob, I can only see a IsScheduleEnabled?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

Theo,

How can you enable/disable schedule for a backup copy job if it runs continuously? It just synchronises with a primary job from time to time. So, it's just NextRun property. Or do you mean specific times, when backup copy job is not allowed to run?

As for Get-VBRJob cmdlet output:
- IsScheduleEnabled - corresponds to job: enabled/disabled
- Options.JobOptions.RunManually - corresponds to schedule: enabled/disabled

Thanks,
Oleg
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hi Oleg,

Thanks a lot for all this! I understand your comment, however there should surely be a way to check if the Get-VBRComputerBackupCopyJob jobs have been disabled or not though?

Also for File to Tape jobs, I'm noticing the job is marked as disabled when it does not have a schedule, even though the job is not disabled in Veeam.

Am I missing something with Veeam here?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

Hi Theo,

Sure, there is. As in case with Get-VBRComputerBackupJob, you are after JobEnabled property.
As for FileToTape job state, it looks like a bug specific to tape jobs. Already passed it to QA.

Thanks,
Oleg
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hi Oleg,

I was talking about Get-VBRComputerBackupCopyJob, not Get-VBRComputerBackupJob, is there a way to see if the job is enabled for those?

Thanks for your help with this, could you keep me updated as to when a fix is rolled out?
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

Theo,

Please re-read my comment. I meant that cases for both cmdlets are the same:

Code: Select all

Get-VBRComputerBackupCopyJob | Select JobEnabled
The fix will be available no sooner than vNext, and I mean major version.

Best regards,
Oleg
Theodore_Hugo
Novice
Posts: 7
Liked: never
Joined: Mar 19, 2021 10:49 am
Full Name: Theo Gordon
Contact:

Re: Getting disabled/not scheduled jobs

Post by Theodore_Hugo »

Hi Oleg,

My mistake, however that still returns an empty field when tested.

Cheers,
Theo
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Getting disabled/not scheduled jobs

Post by oleg.feoktistov »

This is weird and not expected. I could reproduce it only in case with immediate agent backup copy jobs and only for first few minutes after job creation. After that, the value is reflected correctly. I'd advise you to submit a support case. Please share the case id here for further follow-up. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests