I need to write a script in order to have .csv formatted output related to daily backup job statistics, I mean:
- Success
-warning
- errors
- Job name
- Start time
- Duration
- Backup size
I was able to write a script to receive an output like
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/01/2023 22:00:19;0;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/02/2023 22:00:07;57;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/03/2023 22:00:16;59;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/04/2023 22:00:02;21;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/05/2023 22:00:12;59;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/06/2023 22:00:20;59;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/07/2023 22:00:05;1;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/08/2023 22:00:12;58;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/09/2023 22:00:19;59;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/10/2023 22:00:05;57;Success
VEEAM_BCK_VER_PROD_DDBOOST_DD6300;03/11/2023 22:00:10;26;Success
The script is like this
Code: Select all
###########################################################
$jobs = Get-VBRJob
foreach ($job in $jobs) {
$BckJ = Get-VBRBackupSession | Where {$_.jobId -eq $job.Id.Guid} | Sort EndTimeUTC -Descending
#$BckJ | sort Jobname| Format-Table -Property JobName,CreationTime,EndTime,Result
#$BckJ | sort JobName | %{
$BckJ | sort CreationTime | %{
$NameJob = $_.JobName
$StartDate = $_.CreationTime
$EndDate = $_.EndTime
$Res = $_.Result
#$Schedule = $_.SheduleEnabledTime
#
#Duration
#
$Duration = (New-TimeSpan -Start $StartDate -End $EndDate).Minutes
echo $NameJob";"$StartDate";"$Duration";"$Res
}
}
###########################################################
This is a very important value because it is what I send to the backup repository.
I've not found in Get-VBRBackupSession something related to the counters and also to "Backup size"
Could you please give my suggestion about howto find and collect these values?
I'm not a usual powershell programmer and I don't know well powershell+veeam ...
As usual, have my best regards
Pierpa