PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 824
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Get all jobs types

Post by matteu »

Hello,

I would like to know how could I get different jobs count I have ?

Ex :

Backup copy : 2
File Backup : 3
Linux Agent BAckup : 5
SureBackup job : 3
Vmware backup : 8
Vmware replication : 2
....

Today I use this way but maybe there is a better one because I have a warning I should use Get-VBRComputerBackupJob.


Code: Select all

function Get-VeeamSummaryJob
{
    Write-Host "$(Get-Date -Format HH:mm:ss) - VeeamSummaryJob"

    $result=@()
    #Lot of jobs except tape,surebackup catalyst copy
    $result+= Get-VBRJob | Group-Object TypeToString -NoElement | Select-Object Name,Count
    #Tapes jobs
    $result+= Get-VBRTapeJob | Group-Object Type -NoElement | Select-Object Name,Count
    #SureBackup job number
    $Surebackup=[pscustomobject]@{
        Name    = "SureBackupJob"
        #Unsupported method but it's the only way to have Hyper-V surebackup job
        Count   = [Veeam.Backup.Core.SureBackup.CSbJob]::GetAll().count
    }
    $result+= $Surebackup
    $result | Sort-Object name
    Write-Host "$(Get-Date -Format HH:mm:ss) --------------------"
} 
Thanks for your help
oleg.feoktistov
Veeam Software
Posts: 2011
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get all jobs types

Post by oleg.feoktistov »

Backup copy : 2
For backup copy jobs created in v12 and later:

Code: Select all

(Get-VBRBackupCopyJob).Count
File Backup : 3
For NAS backup + NAS backup copy jobs:

Code: Select all

(Get-VBRUnstructuredBackupJob).Count
(Get-VBRUnstructuredBackupCopyJob).Count
Linux Agent Backup : 5
For Linux agent backup jobs:

Code: Select all

(Get-VBRComputerBackupJob | where {$_.OSPlatform -eq "Linux"}).Count
SureBackup job : 3

Code: Select all

(Get-VBRSureBackupJob).Count
For the rest use filters with Get-VBRJob cmdlets. For example:

Code: Select all

(Get-VBRJob | where {$_.TypeToString -eq "VMware Backup"}).Count
Best regards,
Oleg
matteu
Veeam Legend
Posts: 824
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Get all jobs types

Post by matteu »

Hello,

Thanks for your answer.
Unfortunately It's going to be really harder to have a "summary" of all jobs type without the VBRJob object cmdlet :/

It was a good way when you perform an audit to have a quick summary about all the job types and number
Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests