I'm looking for a way to get the backup runtimes per VM so I can do some trending on the numbers.
This is what I got so far:
Code: Select all
$sessions = Get-VBRBackupSession |where{$_.Name -like ("Backup") -and $_.Name -notlike "*Retry*" -and $_.Result -eq "Success"}
$runtimesVMs = @()
foreach($session in $sessions)
{
    $taskSessions = $session | Get-VBRTaskSession
    foreach($task in $taskSessions)
        {
            $row = "" | Select Name,Date,Runtime
            $row.Name = $task.Name
            $row.Date = $task.Progress.StartTimeLocal.Date.ToShortDateString()
            $row.Runtime = [math]::Round((($task.Progress.StopTimeLocal - $task.Progress.StartTimeLocal).TotalHours),1)
            $runtimesVMs += $row
        }
}
$runtimesVMs