I would like to ask for your help, looking here I found a very interesting script that lists for us all the backups that are made.
But I wanted to know if there is a way to put a parameter in it so that
I can insert specific dates to generate the report.
I believe this would be very interesting for everyone.
For it is something that for auditing is of utmost importance
I put the script below here.
Basically I wanted to know if we could put a parameter
Of dates
For example
Date 01/11/2021 to 01/11/2022
Code: Select all
add-PSSnapin "VeeamPSSnapIn" -ErrorAction SilentlyContinue
$HourstoCheck = 100000
$tempArry =@()
$tempArry = Get-VBRBackupSession
$allSesh = $allSesh+ $tempArry
$tempArry =@()
$tempArry = @(Get-VBRJob | ? {$_.JobType -eq "Backup"})
$allJobsBk = $allJobsBk + $tempArry
# Gather all Backup sessions within timeframe
$seshListBk = @($allSesh | ?{($_.CreationTime -ge (Get-Date).AddHours(-$HourstoCheck)) -and $_.JobType -eq "Backup"})
# Get Backup session information
$totalxferBk = 0
$totalReadBk = 0
$seshListBk | %{$totalxferBk += $([Math]::Round([Decimal]$_.Progress.TransferedSize/1GB, 2))}
$seshListBk | %{$totalReadBk += $([Math]::Round([Decimal]$_.Progress.ReadSize/1GB, 2))}
$tempSeshListBk = $seshListBk
$seshListBk = @()
Foreach($job in (Get-VBRJob | ? {$_.JobType -eq "Backup"})) {
$seshListBk += $TempSeshListBk | ?{$_.Jobname -eq $job.name} | Sort-Object CreationTime -Descending | Select-Object -First 10
}
$successSessionsBk = @($seshListBk | ?{$_.Result -eq "Success"})
$warningSessionsBk = @($seshListBk | ?{$_.Result -eq "Warning"})
$failsSessionsBk = @($seshListBk | ?{$_.Result -eq "Failed"})
$runningSessionsBk = @($allSesh | ?{$_.State -eq "Working" -and $_.JobType -eq "Backup"})
$failedSessionsBk = @($seshListBk | ?{($_.Result -eq "Failed") -and ($_.WillBeRetried -ne "True")})
$All = @($seshListBk)
$bodySessSuccBk = $All | Sort Name, Creationtime | Select @{Name="Job Name"; Expression = {$_.Name}},
@{Name="Start Time"; Expression = {$_.CreationTime}},
@{Name="Stop Time"; Expression = {$_.EndTime}},
@{Name="Duration (Mins)"; Expression = {[Math]::Round($_.WorkDetails.WorkDuration.TotalMinutes,2)}},
@{Name="Avg Speed (MB/s)"; Expression = {[Math]::Round($_.Info.Progress.AvgSpeed/1MB,2)}},
@{Name="Total (GB)"; Expression = {[Math]::Round($_.Info.Progress.ProcessedSize/1GB,2)}},
@{Name="Processed (GB)"; Expression = {[Math]::Round($_.Info.Progress.ProcessedUsedSize/1GB,2)}},
@{Name="Data Read (GB)"; Expression = {[Math]::Round($_.Info.Progress.ReadSize/1GB,2)}},
@{Name="Transferred (GB)"; Expression = {[Math]::Round($_.Info.Progress.TransferedSize/1GB,2)}},
Result | ConvertTo-HTML -Fragment
$bodySessSuccBk >c:\temp\test.html