I'm quit struggeling finding a script that will give me a csv file with the backup results per day from the last 3 months.
I know that i can generate a HTML file, but i can't really mingle this in an report.
So i'm looking for a clean and simple script that will generate something like this:
Date.........Job.......Result
19/10/2020 Jobname Success
20/10/2020 Jobname Success
21/10/2020 Jobname Success
22/10/2020 Jobname Success
23/10/2020 Jobname Success
26/10/2020 Jobname Success
Though the result may also be failed, or warning.
So far i found this script, but it summarizes the results. But i want it on a day basis,
Thank you so much in advance!
Code: Select all
Add-PSSnapin "VeeamPSSnapIn"
$MonthlySessions = Get-VBRBackupSession | where {$_.creationtime -ge (Get-Date).AddDays(-30)}
$ReviewDate = Get-Date
$Collection = @()
$origfile = "c:\boot.ini"
Foreach ($job in Get-VBRjob){
$Details = New-Object PSObject
# Puts Job Name in the report
$Details | Add-Member -Name "Veeam Job Name" -MemberType NoteProperty -Value $job.name
# Puts List of Servers in each job into report
$Details | Add-Member -Name "Servers" -MemberType NoteProperty -Value (($job.GetObjectsInJob() | foreach { $_.Name }) -join "," )
# Pulls Monthly Results Failed / Warning / Success
$MonthlyJobSessions = $MonthlySessions | where {$_.origJobname -eq $Job.name}
$FailedJobSessions = $MonthlyJobSessions | where {($_.result -eq "Failed") -and ($_.isretrymode -eq $False)}
$WarningJobSessions = $MonthlyJobSessions | where {($_.result -eq "Warning")}
$SuccessfulJobSessions = $MonthlyJobSessions | where {($_.result -eq "Success")}
# Puts review date in report
$Details | Add-Member -Name "Date of Review" -MemberType NoteProperty -Value $ReviewDate
# Adds Success / Warning / Fail to report
$Details | Add-Member -Name "Number of Successful Sessions" -MemberType NoteProperty -Value $SuccessfulJobSessions.count
$Details | Add-Member -Name "Number of Warning Sessions" -MemberType NoteProperty -Value $WarningJobSessions.count
$Details | Add-Member -Name "Number of Failed Sessions" -MemberType NoteProperty -Value $FailedJobSessions.count
$Collection += $Details
}
$Collection | Export-CSV BackupReview.csv