[PowerShell] Export VBR console job logs

  • 3 December 2020
  • 7 comments
  • 128 views

Userlevel 7
Badge +3
  • On the path to Greatness
  • 199 comments

These days I invested the possibility to programmatically export the same job log shown in VBR console (GUI). @JMeixner gave me the missing link. Now I want to share my outcome here.


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.

 

 

 


7 comments

Userlevel 7
Badge +3

I forgot to mention, there is also a way to get the log of the job, not a single VM. This can be done by a slightly change in the loop:

foreach ($Task in ($BackupSession)) {
$Task.logger.getlog().updatedrecords | select @{N="VM"; e={$task.name}}, starttime, status, title | sort starttime
}

 

Userlevel 7
Badge +2

wow very good !!! :clap:  

Userlevel 7
Badge +2

Great post @vNote42! I didn’t even realize the last bonus tip with selecting all lines and copy to the clipboard was available. Thank you for sharing.

Userlevel 7
Badge +3

Great post @vNote42! I didn’t even realize the last bonus tip with selecting all lines and copy to the clipboard was available. Thank you for sharing.

You are welcome! 

There are some hidden features in VBR console. Here you can find more of these secrets: https://www.running-system.com/veeam-backup-and-replication-update-4-valuable-secrets/

Userlevel 7
Badge +2

Great post @vNote42! I didn’t even realize the last bonus tip with selecting all lines and copy to the clipboard was available. Thank you for sharing.

You are welcome! 

There are some hidden features in VBR console. Here you can find more of these secrets: https://www.running-system.com/veeam-backup-and-replication-update-4-valuable-secrets/

Oh snap, very nice collection Wolfgang. Are you planning a similar list for v10?

Userlevel 7
Badge +3

Great post @vNote42! I didn’t even realize the last bonus tip with selecting all lines and copy to the clipboard was available. Thank you for sharing.

You are welcome! 

There are some hidden features in VBR console. Here you can find more of these secrets: https://www.running-system.com/veeam-backup-and-replication-update-4-valuable-secrets/

Oh snap, very nice collection Wolfgang. Are you planning a similar list for v10?

The list wasn't mine. It is written by a fellow, now working for Veeam :)

Userlevel 4
Badge +1

Excellent post! kudos.

Comment