PowerShell script exchange
Post Reply
Damo23
Lurker
Posts: 1
Liked: never
Joined: Aug 03, 2023 12:59 am
Full Name: Damien Banks
Contact:

Check if job is Enabled

Post by Damo23 »

Hello

I am looking for a way to check if a job is enabled before disabling it. I have found multiple posts using $Job.info.IsScheduleEnabled = "True", however I do not want to check the schedule, but the actual job. Is this possible. My mutt of a script is below.

Code: Select all

 
$job = Get-VBRJob | Where-Object { $_.Name -eq $JobName }
 	# Check if the job is enabled
        if (#CHECK IF JOB IS ENABLED) {
            # Disable the job
            Disable-VBRJob -Job $job
            Write-Host "Job '$JobName' has been disabled."
         } else {
            Write-Host "Job '$JobName' is already disabled."
rovshan.pashayev
Veeam Software
Posts: 260
Liked: 42 times
Joined: Jul 03, 2023 12:44 pm
Full Name: Rovshan Pashayev
Location: Czechia
Contact:

Re: Check if job is Enabled

Post by rovshan.pashayev »

Hello,

Try using

Code: Select all

$job = Get-VBRComputerBackupJob -Name "Example Job Name"
$job.Enabled 
This will return True if the job is enabled and False if it is disabled.

Rovshan
Rovshan Pashayev
Analyst
Veeam Agent for Linux, Mac, AIX & Solaris
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests