PowerShell script exchange
Post Reply
gerwin
Service Provider
Posts: 9
Liked: never
Joined: Aug 04, 2011 5:49 pm
Full Name: Gerwin Goodschalk
Contact:

Latest full backup size by job

Post by gerwin »

Does anyone know how we can get the full backup size by job.
Then calculated based on the latest full backup.

We are using VBR v12.
oleg.feoktistov
Veeam Software
Posts: 2011
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Latest full backup size by job

Post by oleg.feoktistov »

Hi Gerwin,

If I correctly understood your request, to get the size of the whole backup, you need to calculate the sizes of all storages:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Job'
$storages = $backup.GetAllChildrenStorages()
$backupSize = $null
foreach ($storage in $storages) { 
  $storageSize = [Math]::Round($storage.Stats.BackupSize / 1GB, 1)
  $backupSize += $storageSize
}

$backup | select Name, @{n='SizeGB';e={$backupSize}}
To get the size of the latest full backup:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Job'
$storages = $backup.GetAllChildrenStorages()
$backupSize = $null
foreach ($storage in $storages) { 
  $storageSize = [Math]::Round($storage.Stats.BackupSize / 1GB, 1)
  $backupSize += $storageSize
}

$storages | where {$_.IsFull -eq $true} | Sort-Object -Property CreationTimeUTC -Descending | `
select PartialPath, CreationTimeUTC -First 1 
Best regards,
Oleg
gerwin
Service Provider
Posts: 9
Liked: never
Joined: Aug 04, 2011 5:49 pm
Full Name: Gerwin Goodschalk
Contact:

Re: Latest full backup size by job

Post by gerwin »

Thanks Oleg,

The 2nd script works fine with backups that are not "per vm" saved. Then we only get the latest Full backup of 1 VM inside the job.
Do you know a way to filter all the VM's at "Per VM" basis job?
oleg.feoktistov
Veeam Software
Posts: 2011
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Latest full backup size by job

Post by oleg.feoktistov »

For Per-VM backups you need to get child backups first and then the workflow is the same:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Job'
$childBackups = $backup.FindChildBackups()
$storages = $childBackups.GetAllChildrenStorages()
...
Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests