PowerShell script exchange
Post Reply
vmtech123
Veeam Legend
Posts: 235
Liked: 134 times
Joined: Mar 28, 2019 2:01 pm
Full Name: SP
Contact:

Calculate amount of data change

Post by vmtech123 »

Is there a way to get the data change or transferred for all incremental backups. or backups in general?

I'd like to calculate the total change of all my jobs in a day to somewhat predict what the data change rate would be if I set up a cloud repo.

I have quite a few backup jobs
vmtech123
Veeam Legend
Posts: 235
Liked: 134 times
Joined: Mar 28, 2019 2:01 pm
Full Name: SP
Contact:

Re: Calculate amount of data change

Post by vmtech123 »

I'll add. I used the following script, but it's too much. I just want the incremental data not including my tape jobs and copy jobs.

Code: Select all

$sesion= Get-VBRBackupSession | where {$_.JobType -eq "Backup"}| where {$_.jobld -eq $Job.ld.Guid}
$Backups= $sesion| where {$_.Result -ne "None"}| Measure-Object|select Count
$totalBackups= $Backups -replace "@{Count=","" -replace "}","" 


#Total of Data transfered x Month

$tasksession= Get-VBRBackupSession | where {$_.JobType -eq "Backup"}| where {$_.jobld -eq $Job.ld.Guid}| Get-VBRTaskSession
$transfer= $tasksession| select @{N='TransferedSizeGB';E={[Math]::round([Decimal]($tasksession.Progress.TransferedSize |Measure-Object -Sum).Sum/1TB, 2)} }|select -First 1
$totalSize= $transfer -replace "@{TransferedSizeGB=","" -replace "}",""

Write-Host "Total Backups x Month is: $totalBackups Backups" 
Write-Host "Total Transfered Backup Size x Month is: $totalSize TB"
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Calculate amount of data change

Post by oleg.feoktistov » 1 person likes this post

Hi,

Try adding IsFullMode - eq $false to your sessions filter:

Code: Select all

$sessions = Get-VBRBackupSession | where {$_.JobType -eq "Backup" -and $_.Info.IsFullMode -eq $false}| `
where {$_.jobld -eq $Job.ld.Guid} 
Keep in mind though that it won't work in case with agent management jobs.
You would need to get child sessions using unsupported .NET methods to make IsFullMode reflect correct value:

Code: Select all

$sessions = [Veeam.Backup.Core.CBackupSession]::GetByJob($job.Id)
$child = $sessions.GetChildSessions()
$child | where {$_.IsFullMode -eq $false}
Further on, the stats for agent management job will be in a child backup session, not in a task session. Thus, you'll need to access $child.Progress to get them.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests