PowerShell script exchange
Post Reply
falkob
Veeam Vanguard
Posts: 86
Liked: 31 times
Joined: Sep 28, 2017 7:47 am
Full Name: Falko Banaszak
Contact:

Veeam Backup Reporting of Used Backup Storage

Post by falkob »

Hello guys,

actually iam becoming desperate because i can't get anything to work for the things i want with reporting Backup Jobs.

So i'll briefly describe what i want to achieve.

I have Agent Backups, VMware Backups and Cloud Connect Backups. We don't have Veeam ONE. We have Backup jobs per customer. So 1 Backup Job equals to 1 customer.

I want to achieve the following:

An output / export etc. on a job base with the following data.

- All VM's in the Backup Job
- Original VM Size / System SIze
- Dedup Ratio per VM
- Compression Ratio per VM
- Written Backup Size per VM

I already built a script to share with the community to read out the created directory in which Veeam Backups are stored.
This is only for reporting the whole Backup Storage consumption and does not respect deduplication and compression. (run on a windows server which holds the Backup Repositories)

Code: Select all

#------------------------------------------------------------------------------#
# Script:   FolderSize.ps1                                                     #
# Author:   falkob                                                             #
# Date:     First created on 20.03.2017 15:51                                  #
# Keywords: Veeam Cloud Connect, Folder Size, Used Storage                     #
#                                                                              #
# **COMMENTS ON THIS SCRIPT**                                                  #
#                                                                              #
#                                                                              #
#------------------------------------------------------------------------------#

$tabelle =  @()

$LW = "D","E","F","G"

foreach ($i in $LW)
{
    $folders = Get-ChildItem ($i + ":\VEEAMBACKUPS\")

foreach ($folder in $folders)
{
    $size = [MATH]::Round(((Get-ChildItem ($i + ":\VEEAMBACKUPS\$($folder.name)") -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB),0)
    $sizegb = [MATH]::Round(((Get-ChildItem ($i + ":\VEEAMBACKUPS\$($folder.name)") -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1GB),2)
    $sizetb = [MATH]::Round(((Get-ChildItem ($i + ":\VEEAMBACKUPS\$($folder.name)") -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1TB),3)
    
    $array = New-Object PSCustomObject
    $array | Add-Member -type NoteProperty -name Folder -Value $folder.name
    $array | Add-Member -type NoteProperty -name MB -Value $size
    $array | Add-Member -type NoteProperty -name GB -Value $sizegb
    $array | Add-Member -type NoteProperty -name TB -Value $sizetb
  
    $tabelle += $array
}

}

 $tabelle
 $tabelle | export-csv -Path C:\Veeam_Storage_Reports\Veeam_Storage_Report_$((Get-Date).ToString('dd-MM-yyyy-hh-mm-ss')).csv -Encoding UTF8 -NoTypeInformation
Due to the fact, that i have backup jobs per customer, i can achieve to get the used storage space per customer.

But i also need it per VM and this is where i need help.

I really like to get this with Powershell, because i can automate this.

Basically the "Backup Properties" window would fit perfect. But with splitted up values per VM.

If someone can help me to achieve this, i would really appreciate it !

Thanks and Best Regards !
VCP6.5-DCV, VCP6-DCV, VMCE, VMCA, Veeam Vanguard, VMware vExpert
https://www.virtualhome.blog
Talom
Enthusiast
Posts: 43
Liked: 6 times
Joined: Oct 21, 2014 7:56 am
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by Talom » 1 person likes this post

You can get the Jobs with their objects with:

Code: Select all

$jobs = Get-VBRJob
foreach ($job in $jobs) {
if ($job -ne $NULL){
                     $objects = $job.GetObjectsInJob()
               }
}
But I think, what you really need is in the BackupSessions with their TaskSessions.
You can get them with

Code: Select all

$sessions = Get-VBRBackupSession
foreach ($session in $sessions ) {
                    $TaskSessions = $session.GetTaskSessions()
               }
}
BACKUP EAGLE® Developer
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by veremin »

I'm also wondering whether you're using per-VM backup chain or not. Thanks.
falkob
Veeam Vanguard
Posts: 86
Liked: 31 times
Joined: Sep 28, 2017 7:47 am
Full Name: Falko Banaszak
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by falkob »

Hello all,

iam not using per VM backup files.
Each customer equals 1 backup Job with all VM's in it.
VCP6.5-DCV, VCP6-DCV, VMCE, VMCA, Veeam Vanguard, VMware vExpert
https://www.virtualhome.blog
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by veremin » 1 person likes this post

Then, it will be impossible to get the following information, since we're talking about single monolithic backup file:

- Dedup Ratio per VM
- Compression Ratio per VM
- Written Backup Size per VM

Thanks.
falkob
Veeam Vanguard
Posts: 86
Liked: 31 times
Joined: Sep 28, 2017 7:47 am
Full Name: Falko Banaszak
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by falkob »

If i would use "per VM backup files", could i get those information ?

Does "per VM backup files" use more storage ?

Thank you !
VCP6.5-DCV, VCP6-DCV, VMCE, VMCA, Veeam Vanguard, VMware vExpert
https://www.virtualhome.blog
sdavey311
Lurker
Posts: 1
Liked: 1 time
Joined: Jan 11, 2019 3:37 pm
Full Name: Simon Davey
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by sdavey311 » 1 person likes this post

Dear Teams,

I have also been trying to get this information from Powershell, but I do not think there are any methods/properties that show this data "per task". Is this still correct for Veeam 9.5.x? This is the situation where one job contains multiple VMs and a single storage file.

Thank you.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Veeam Backup Reporting of Used Backup Storage

Post by veremin » 1 person likes this post

It is not possible due to the reasons stated above. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests