PowerShell script exchange
Post Reply
ortoscale
Service Provider
Posts: 246
Liked: 20 times
Joined: Aug 02, 2011 9:30 pm
Full Name: Matjaž Antloga
Location: Celje, Slovenia
Contact:

get-vbrepjob feature request

Post by ortoscale »

Hi There

get-vbrepjob returns some basic info but not close to -get-vbrjob

Can you add at least LatestRunLocal?
we are monitoring agent jobs and some are green (because last status is Success) altough they haven't been run for a week or month etc?

Thanks!
veremin
Product Manager
Posts: 20285
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: get-vbrepjob feature request

Post by veremin »

What you're using this cmdlet for? I'm wondering because we have an extensive PS model for agent management backup and backup copy jobs, and those objects (VBRComputerBackupJob, VBRComputerBackupCopyJob) should have the properties you're after. Thanks!
ortoscale
Service Provider
Posts: 246
Liked: 20 times
Joined: Aug 02, 2011 9:30 pm
Full Name: Matjaž Antloga
Location: Celje, Slovenia
Contact:

Re: get-vbrepjob feature request

Post by ortoscale »

can we get info about (VBRComputerBackupJob, VBRComputerBackupCopyJob) with Get-????? command when connected to VBR?
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: get-vbrepjob feature request

Post by jhoughes » 1 person likes this post

You can get the details that you are looking for between the 'Get-VBRComputerBackupJob' and 'Get-VBRComputerBackupJobSession' cmdlets.

I'll write up a simple script which will display all VBRComputerBackup jobs and their status/last run details shortly.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
ortoscale
Service Provider
Posts: 246
Liked: 20 times
Joined: Aug 02, 2011 9:30 pm
Full Name: Matjaž Antloga
Location: Celje, Slovenia
Contact:

Re: get-vbrepjob feature request

Post by ortoscale »

Many thanks!
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: get-vbrepjob feature request

Post by jhoughes » 2 people like this post

Apologies for the delay, my kids didn't cooperate with bedtime last night to give me time to get to this after hours.

This should help you out, I left the code to output to the console as well as export to CSV file.

Code: Select all

$ComputerJobs = Get-VBRComputerBackupJob

foreach ($EachJob in $ComputerJobs) {

  $Sessions = Get-VBRComputerBackupJobSession -Name "*$($EachJob.Name)*"

  [System.Collections.ArrayList]$AllComputerSessionsObject = @()

  foreach ($IndividualSession in $Sessions) {

    $SessionOutput = [PSCustomObject][Ordered] @{

      'JobName'           = $($EachJob.Name)
      'CreationTime'      = $IndividualSession.CreationTime
      'EndTime'           = $IndividualSession.EndTime
      'Result'            = $IndividualSession.Result
      'State'             = $IndividualSession.State
      'JobEnabled'        = $EachJob.JobEnabled
      'JobId'             = $IndividualSession.JobId
      'SessionId'         = $IndividualSession.Id

    }

    $null = $AllComputerSessionsObject.Add($SessionOutput)

    Remove-Variable -Name SessionOutput | Out-Null
  }


}

Write-Output $AllComputerSessionsObject
$AllComputerSessionsObject | Export-Csv -Path ./ComputerJobSessionReport.csv -NoTypeInformation
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests