Skip to main content

For those doing forever forward incremental jobs, this is a handy scrip to see the size of your jobs each day. If you use Synthetic jobs, or reverse incremental you may get unexpected results as your latest file will be the full backup file. 

 

While doing some planning for new storage I wanted to see how big a daily backup of all jobs on a proxy was.


Here is a little script I came up with that you can modify the section “Current.Date.AddDays(-1)” to look back further. I may modify the code at a later time to fine tune this. 

 

This worked well to go back a few days, then see the average daily size. Add that to your total full backup size and you can predict out the space needed to meet your retention policies.

 

# Location of the Veeam backup folder
$BackupFolderPath = "F:\Backups"

# Current date
$CurrentDate = Get-Date

# Date of the day before
$PreviousDay = $CurrentDate.AddDays(-1).ToString('yyyy-MM-dd')

# Function to convert bytes to GB
function ConvertTo-GB {
param (
>Parameter(Mandatory=$true)]
>int64]
$bytes
)
return "{0:N2}" -f ($bytes / 1GB) + " GB"
}

# Get all backup files from the previous day
$BackupFiles = Get-ChildItem -Path $BackupFolderPath -Recurse -Filter "*$PreviousDay*"

# If there's no backup file from the previous day, exit the script
if ($BackupFiles -eq $null) {
Write-Output "No backup files from the day before were found."
exit
}

# Sum up the sizes of all backup files
$TotalBackupSizeBytes = 0
foreach ($BackupFile in $BackupFiles) {
$TotalBackupSizeBytes += (Get-Item $BackupFile.FullName).Length
}

# Convert bytes to GB
$TotalBackupSizeGB = ConvertTo-GB -bytes $TotalBackupSizeBytes

# Print the total size of the backup files
Write-Output "The total size of the backup files from the day before is $TotalBackupSizeGB."

 

Thanks for sharing this.  Another one to add to the collection.  😎


Comment