Quantcast
Channel: R&D Forums
Viewing all articles
Browse latest Browse all 9966

PowerShell • Re: Report for Last Full Backup

$
0
0
Hi,

Try this code:

Code:

$restorePoints = Get-VBRRestorePoint | Where-Object { $_.Type -eq "Full" } | Sort-Object -Property CreationTime -Descending$lastFullBackups = $restorePoints | Group-Object -Property { $_.Name } | ForEach-Object { $_.Group | Select-Object -First 1 } $jobs = Get-VBRJob$fullBackupInfo = @()foreach ($backup in $lastFullBackups) {    $duration = $null    $transferedSize = $null    $storage = $backup.GetStorage()    $backupSize = [Math]::Round($storage.Stats.BackupSize/1GB, 2)    $job = $jobs | Where-Object { $_.GetObjectsInJob().ObjectId -eq $backup.ObjectId -and $backup.GetBackup().JobId -eq $_.Id }    $session = Get-VBRBackupSession -Id $backup.JobRunId -ErrorAction SilentlyContinue    if ($session) {      $taskSession = $session.GetTaskSessions() | where {$_.ObjectId -eq $backup.ObjectId}      $duration = $taskSession.Progress.Duration.ToString()      $transferedSize = [Math]::Round($taskSession.Progress.TransferedSize/1GB, 2)    }    $fullBackupInfo += $backup | select @{n="Object Name";e={$backup.Name}}, `                     @{n="Creation Time";e={$backup.CreationTime}}, `                     @{n="Job Name";e={$job.Name}}, `                     @{n="Job Type";e={$job.TypeToString}}, `                     @{n="Duration";e={$duration}}, `                     @{n="Transfered Size GB";e={$transferedSize}}, `                     @{n="Backup Size GB";e={$backupSize}}} $fullBackupInfo
As for backup server info, you can fetch it with the cmdlet below:

Code:

Get-VBRBackupServerInfo
Best regards,
Oleg

Statistics: Posted by oleg.feoktistov — Jan 05, 2024 7:06 pm



Viewing all articles
Browse latest Browse all 9966

Latest Images

Trending Articles



Latest Images