These days I invested the possibility to programmatically export the same job log shown in VBR console (GUI).
First, select the backup session of the job you want to get the log from. To select the job session run latest, you can do this with a command like this:
$BackupSession = Get-VBRBackupSession -Name "Job 1*" | Sort-Object CreationTime | Select-Object -last 1
Here the name of the job is actually "Job 1". But -Name
is the name of the running job. This means it includes a postfix like "(Incremental)", therefore *
.
I use -Name
because this is much faster than using | where {$_.jobname -eq "Job 1"}
When you have the backup session, run this to get the logs for each VM in this job.
foreach ($Task in ($BackupSession | Get-VBRTaskSession)) {
$Task.logger.getlog().updatedrecords | select @{N="VM"; e={$task.name}}, starttime, status, title | sort starttime
}
By the way, there is a hidden feature in the VBR console: If you want a (sometimes even more detailed) log including date/time, mark all lines, right-click, copy to clipboard and past in an editor.