Page 1 of 1

PowerShell to gather backup sizes per server??

Veeam LogoPosted: Thu Oct 13, 2016 1:18 pm
by tommls
VMware has a cmdlet such that one can get a list of VMs' provisioned and used disk sizes.

Does Veeam have anything PowerShell that can do something similar??

I want to nightly get a list of the VMs backed up by Veeam with the size of the daily backup size per VM and the backup date (Get-Date).

I want a csv file output that I can put into Access and calculate daily changes.

Can anyone suggest a script for this?? Or at least the proper PowerShell code to output the daily backup size per VM??

Veeam support says they don't have anything to do this, which surprised me.

What I want is this: "You can see the VMs backed up by a job by going to the statistics of the job. To do this, right click on the job and select Statistics. In the left inside you will see a list of VMs. To see the size of the backup files, go to Backup & Replication --> Backups --> Disk, right click on your Job and select "Properties". The column Backup Size will show you the size of each backup file and the date when the file was created."

I want something to output this data rather than clicking all these backups every day...I can't imagine there's not a way via PowerShell, I'm just not knowledgeable enough to know or find it but once I know what it is I can work with it...This should be something standard in the application.

Thank you, Tom

how to get $Session.Info Backup Size PER VM PER JOB??

Veeam LogoPosted: Thu Oct 13, 2016 2:14 pm
by tommls
I found this in another forum thread, how can I make $Session.Info.BackupTotalSize become ALSO backup size PER VM??
Or anything similar??
I need a script that will look at each job and output the backup size per VM per job daily, after backups have finished.
What is the correct session variable to use??
Is there a list somewhere of session variables obtainable per VM per job per day??

Another way to put it: I need all the backup job properties per job per VM per day.

Thank you, Tom

asnp VeeamPSSnapin
$Job = Get-VBRJob -Name "Name of your job"
$Session = $Job.FindLastSession()
$Session.State
$Session.CreationTime
$Session.EndTime
$Session.Info.BackupTotalSize
$Session.BackupStats.CompressRatio
$Session.BackupStats.DataSize
$Session.BackupStats.DedupRatio

Thank you, Tom

Re: PowerShell to gather backup sizes per server??

Veeam LogoPosted: Fri Oct 14, 2016 1:38 pm
by tdewin
Check out Mimicscript : https://github.com/VeeamHub/powershell/ ... Report.ps1

Look for function calculate-vm and calculate-job. Those basically show you all the fields you are looking for and that are shown in the B&R reports (hence the name MimicReport) (perticiular how to get the "per vm session")

Final note, there is not field that says how much one VM represents inside a single restore point (it is also not something you can look up in the gui)

Re: PowerShell to gather backup sizes per server??

Veeam LogoPosted: Thu Mar 29, 2018 1:59 pm
by Andreas Neufert
Wrote a small example for a customer for v9.5u3

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue

Disconnect-VBRServer | out-null
connect-vbrserver -server dnsservername -user domain\username



Foreach ($JobObject in Get-VBRJob | ?{$_.JobType -eq "Backup"})
{
$LastSession = $JobObject.FindLastSession()
$JobObject.Name
$LastSession.endtime
$LastSession.Info.Progress.TotalUsedSize
$LastSession.Info.Progress.ReadSize
$LastSession.Info.Progress.TransferedSize
Write-Host "--------------------------------"
}

Re: PowerShell to gather backup sizes per server??

Veeam LogoPosted: Sun Apr 15, 2018 10:54 pm
by Andreas Neufert
And again a new version that makes it more easy to look at the output (or import into Excel by copy and paste):

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue

Disconnect-VBRServer | out-null
connect-vbrserver -server HQ-VBR1 -user amust\aneufert

$JobsOutput = @()


Foreach ($JobObject in Get-VBRJob | ?{$_.JobType -eq "Backup"})
{
$LastSession = $JobObject.FindLastSession()
$JobOutput = New-Object -TypeName PSObject
$JobOutput | Add-Member -Name "Jobname" -MemberType Noteproperty -Value $JobObject.Name
$JobOutput | Add-Member -Name "Endtime" -MemberType Noteproperty -Value $LastSession.endtime
$JobOutput | Add-Member -Name "TotalUsedSize" -MemberType Noteproperty -Value $LastSession.Info.Progress.TotalUsedSize
$JobOutput | Add-Member -Name "ReadSize" -MemberType Noteproperty -Value $LastSession.Info.Progress.ReadSize
$JobOutput | Add-Member -Name "TransferedSize" -MemberType Noteproperty -Value $LastSession.Info.Progress.TransferedSize
$JobsOutput += $JobOutput

}
$JobsOutput | Out-GridView
Disconnect-VBRServer | out-null

Re: PowerShell to gather backup sizes per server??

Veeam LogoPosted: Tue Apr 17, 2018 1:11 pm
by tommls
Thank you!! :) :)