PowerShell script exchange
Post Reply
ian.salgado
Novice
Posts: 5
Liked: never
Joined: Nov 16, 2022 9:51 am
Full Name: Ian Salgado
Contact:

Enable or Disable Job

Post by ian.salgado »

Hi,

I got the following script which is working well

Code: Select all

$now = Get-Date -Format dd-MM-yyyy_HH-mm
$results_array = @()

$jobs = Get-VBRJob | Where-Object {$_.IsBackup}
    ForEach ($job in $jobs) {
        $lastsession = $job.FindLastSession()
        foreach ($tasksession in $lastsession.GetTaskSessions()) {
            $objResult = [pscustomobject][ordered]@{                
                Job             = $job.Name 
                Status          = $job.GetLastResult()
                BackupMethod = $job.Options.BackupTargetOptions.Algorithm -replace "Syntethic","Reversed"
                RestorePoints = $job.Options.BackupStorageOptions.RetainCycles
                PointsOnDisk = (get-vbrbackup -Name $job.Name | Get-VBRRestorePoint -Name $tasksession.Name | Measure-Object).Count
                ProxyName = If ($job.SourceProxyAutoDetect -eq $True) {"Automatic proxy selection is enabled."} else {($job | Get-VBRJobProxy).name}
            }
            $results_array += $objResult
        }
    }

#Export to CSV file
$CSVreportfilename = "E:\Viatek\Veeam_Scripts\Veeam-daily-Report-" + $now + ".csv"
$results_array | Sort-Object Server, JobName, VmName | Export-CSV $CSVreportfilename -NoTypeInformation
I would like to add an line where the script check to see if the job is enable or disable ?

could you please help ?

cheers

Ian
Last edited by HannesK on Feb 17, 2023 6:33 am, edited 1 time in total.
Reason: code formatting
HannesK
Product Manager
Posts: 14648
Liked: 2990 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Enable or Disable Job

Post by HannesK »

Hello,
did you already check the options posted here?

Best regards,
Hannes
Post Reply

Who is online

Users browsing this forum: BHB3805 and 3 guests