PowerShell script exchange
Post Reply
petersonal
Novice
Posts: 5
Liked: never
Joined: Apr 20, 2020 10:17 am
Full Name: Peter Brogyanyi
Contact:

get backup job item status

Post by petersonal »

Hi!
I am new to Veeam powershell. We have Veeam Backup & Replication 11.0.1.1261 P20220302. I am using Get-VBRJob command to get a bakcup job. The job contains multiple virtual machine backups. If I get a Warning as a job last result, I would like to know, wich virtual machine caused the result. Is this possible?
thanks
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: get backup job item status

Post by oleg.feoktistov » 1 person likes this post

Hi Peter,

To get the virtual machine name that caused the warning, you need to query task sessions of the last backup session:

Code: Select all

$job = Get-VBRJob -Name 'Job Name'
$lastSession = Get-VBRBackupSession | where {$_.JobId -eq $job.Id} | sort -Property EndTime | select -Last 1
$taskSession = Get-VBRTaskSession -Session $lastSession | where {$_.Status -like $lastSession.Result}
$taskSession
$taskSession.Name will be equal to the name of a virtual machine.

Best regards,
Oleg
petersonal
Novice
Posts: 5
Liked: never
Joined: Apr 20, 2020 10:17 am
Full Name: Peter Brogyanyi
Contact:

Re: get backup job item status

Post by petersonal »

Thank you it's working like miracle :)
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests