Monitor Backup Copy job

PowerShell script exchange

Monitor Backup Copy job

Veeam Logoby Zedification » Thu Jun 26, 2014 9:03 am

Hello,

I searching for a script sample to monitor the continuous backup copy job status.
I want to report the succes, warning or failed status. I am not very aware about scripting so be cool with me. :D

Thanks.

Zed!
Zedification
Enthusiast
 
Posts: 31
Liked: 5 times
Joined: Thu Jul 29, 2010 8:34 am
Full Name: Zed

Re: Monitor Backup Copy job

Veeam Logoby v.Eremin » Thu Jun 26, 2014 9:09 am

Hi, Zed, using the following script you can the latest state of backup copy:

Code: Select all
asnp VeeamPSSNapin
$Job = Get-VBRJob -name "Name of backup copy Job"
$LastSession = $Job.FindLastSession()
$LastSession.State

Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Monitor Backup Copy job

Veeam Logoby Zedification » Thu Jun 26, 2014 12:26 pm

Thanks.
I will try that and keep you aware.

Zed!
Zedification
Enthusiast
 
Posts: 31
Liked: 5 times
Joined: Thu Jul 29, 2010 8:34 am
Full Name: Zed

Re: Monitor Backup Copy job

Veeam Logoby v.Eremin » Thu Jun 26, 2014 1:14 pm

Be aware that the script provided is one time procedure, if you want to make it report on continuous basis, you will have to create a cycle. Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Monitor Backup Copy job

Veeam Logoby toon.v10 » Mon Jul 14, 2014 11:54 am

Hi,

With the FindLastSession() method it shows the state of the current running copy job. Since it's a continous job it's state is idle and Last Result value is None.
What i want to know is if the latest finished copy job was successfull.
I can do that now by getting all the sessions, sort by date and then select the second one, but it's cumbersome.
I think it would be better to change the method FindLastSession so that it displays the information of the latest finished session, not the currently running (idle state) session, or is there another way to achieve this?
toon.v10
Novice
 
Posts: 6
Liked: 3 times
Joined: Sat Oct 12, 2013 4:10 am
Full Name: Toon Vandendriessche

Re: Monitor Backup Copy job

Veeam Logoby v.Eremin » Mon Jul 14, 2014 2:24 pm 1 person likes this post

I think it would be better to change the method FindLastSession so that it displays the information of the latest finished session, not the currently running (idle state) session, or is there another way to achieve this?

This is by design. The FindLastSession method returns the latest session, not the last finished one.

The approach described by you (second session, etc.) should do the trick:

Code: Select all
$Session = Get-VBRBackupSession | ? {$_.jobname -eq $Job.Name} | sort {$_.CreationTime} -Descending | select -first 2 | select -Last 1
$Session.Result


Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests