I recently set up a VBR server that manages the backup of physical servers via jobs (backup on local disk) + copyjob (export to our DC). The copyjobs are configured in "continuous" mode. I would like to create a report that allows me to get the status of the last copyjob (success, error, warning or in progress). I had managed to do this in powershell but I found myself with anomalies because VBR returns an error in "LastResult" while when I open the session the backup is successful.
Here is the query I created with SQL but it doesn't show me all the copyjobs
Code: Select all
DECLARE @yesterday AS datetime
SET @yesterday = (select dateadd(d,-1,getdate()))
DECLARE @today AS datetime
SET @today = (select getdate())
select max(end_time) as MaxTime, job_name, success, failed, warning, inprogress
FROM [VeeamBackup].[dbo].[ReportSessionView]
where creation_time > @yesterday
AND end_time < @today
and job_source_type = 5
AND end_time <> '1900-01-01 00:00:00.000'
--AND state <> 9
GROUP BY job_name, success, failed, warning, inprogress
order BY job_name DESC