PowerShell script exchange
Post Reply
CamiloTN
Influencer
Posts: 11
Liked: 3 times
Joined: Feb 19, 2021 1:59 pm
Full Name: Oscar Camilo Tafur Narvaez
Contact:

Report Powershell jobs and Data Transfered x Month

Post by CamiloTN »

Hi,

I want to ask for you guys for help, I want to know how many backups my VBRjobs have made x Month, as well as how many Data was transfered x Month . I made a Script and I compared the results with the Report "Job History" and I saw that powershell doesn´t bring Information when the Backup Type is "Mixed". This is my Script:


#Calculate Number of Backups x Jobs

$sesion= Get-VBRBackupSession |where {($_.JobType -eq "Backup")}|Measure-Object |select Count
$totalBackups= $sesion -replace "@{Count=","" -replace "}",""

#Total of Data transfered x Month

$tasksession= Get-VBRBackupSession |where {($_.JobType -eq "Backup")}| 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 is: $totalBackups Backups"
Write-Host "Total Transfered Backup Size is: $totalSize TB"

My Question is: How can I include the "Mixed" backups in my Script ?

Thanks for your help :).

Best Regards,

Camilo TN
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Report Powershell jobs and Data Transfered x Month

Post by david.domask »

Hey Oscar,

Can you show an example of you script where it's not working as expected and what you mean by "Mixed"?

I actually just am not sure where you see a challenge.
David Domask | Product Management: Principal Analyst
CamiloTN
Influencer
Posts: 11
Liked: 3 times
Joined: Feb 19, 2021 1:59 pm
Full Name: Oscar Camilo Tafur Narvaez
Contact:

Re: Report Powershell jobs and Data Transfered x Month

Post by CamiloTN »

Hi David,

I mean, when I make two Types of Backups with one Job to different machines, For example, I make a backup with the Job Veeambck, however, the backups are MachineA= Full / MachineB= Incremental, the Report "Job History" shows this Type of backup as Mixed, when I look for them up in powershell , I cannot see data, even when I look for them up as a Full or Incremental Backup. I should see this type of backups, but Unfortunatelly no, Then it´s not consistent the info that I get from Powershell if I compare it with the Info that I get from the Report "Job History", There´s more details in this Report but the Report doesn´t tell me how many jobs were made or how many Data was transfered x Month without a Excel formula.
CamiloTN
Influencer
Posts: 11
Liked: 3 times
Joined: Feb 19, 2021 1:59 pm
Full Name: Oscar Camilo Tafur Narvaez
Contact:

Re: Report Powershell jobs and Data Transfered x Month

Post by CamiloTN »

Hi,

I found a Solution:

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" 
Sorry if there´s a couple of errors or redundance, I´m not a powershell Expert but... you cann feel free to change it.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests