PowerShell script exchange
Post Reply
Talom
Enthusiast
Posts: 43
Liked: 6 times
Joined: Oct 21, 2014 7:56 am
Contact:

TaskSessions for Nutanix Backups

Post by Talom »

Hello,

i'm trying to get details for a Nutanix Backup Job.
It was no problem to get the session details through the following code:

Code: Select all

  foreach($job in $nutanixjobs) {
  
         $nutanixsessions = [veeam.backup.core.cbackupsession]::GetByJob($job.id)  | Where-Object { $_.EndTime -ge $date}  
         $reloadedsessions = @()
         foreach($sess in $nutanixsessions){
            $sess = [veeam.backup.core.cbackupsession]::Get($sess.Id, $job)
            $reloadedsessions += $sess
         }
         $reloadedsessions
         $sessions += $reloadedsessions
         
    }
Normally i just call getTaskSessions() for each session but this does not return anything in this case.

How i can i load the task sessions for a nutanix backup session?
BACKUP EAGLE® Developer
jhoughes
Veeam Vanguard
Posts: 282
Liked: 113 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: TaskSessions for Nutanix Backups

Post by jhoughes » 2 people like this post

This should help you out, as you need to filter based on the proper Nutanix job type even for a particular job ID.

You're on the right track with the '.GetTaskSessions()' method, but you're working with the incorrect job session object.

Sample script

This other script will give a better breakdown of the job types, based on the following block of code:

Code: Select all

$AllJobs = [Veeam.Backup.Core.CBackupJob]::GetAll()
$Nutanix_Policy_Jobs = $AllJobs | Where-Object { $_.TypeToString -like "Nutanix*" -AND $_.JobType -eq "VmbApiPolicyTempJob" }
$Nutanix_VM_Jobs = $Nutanix_Policy_Jobs | Where-Object { $_.FindChildJobs().JobType -eq 'EndpointBackup' }

$Nutanix_Meta_Jobs = $Nutanix_Policy_Jobs | Where-Object { !($_.FindChildJobs()) }
$Nutanix_Snapshot_Jobs = $Nutanix_Meta_Jobs | Where-Object { $_.GetViOijs().TypeDisplayName -eq 'Virtual Machine' }
$Nutanix_PD_Jobs = $Nutanix_Meta_Jobs | Where-Object { $null -eq $_.GetViOijs().TypeDisplayName }
This is what I was able to differentiate when creating a requested report against VAN for v10 (these terms are just mine to explain as an abstract structure):
  • Nutanix "Policy-based" jobs have a TypeToString matching 'Nutanix*', and a job type of 'VmbApiPolicyTempJob'
  • Nutanix "VM-specific" jobs have child jobs with a job type of 'EndpointBackup'
  • Nutanix "meta" jobs are policy jobs that have no child jobs
  • Nutanix "snapshot jobs" are the meta jobs that have a job object which is of type 'Virtual Machine'
  • Nutanix "Protection Domain" jobs are the meta jobs where the job objects have no type name

Typical caveats here... all of this is leveraging unsupported methods, and the structure/explanation of the jobs/types are all from creating a new lab environment and performing my own investigation. I have not confirmed that any of this code remains unchanged against a v11 instance.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
Talom
Enthusiast
Posts: 43
Liked: 6 times
Joined: Oct 21, 2014 7:56 am
Contact:

Re: TaskSessions for Nutanix Backups

Post by Talom »

Thx, that helped a lot.
BACKUP EAGLE® Developer
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests