PowerShell script exchange
Post Reply
MarkBoothmaa
Veeam Legend
Posts: 181
Liked: 49 times
Joined: Mar 22, 2017 11:10 am
Full Name: Mark Boothman
Location: Darlington, United Kingdom
Contact:

Script to show description along with # objects and backup size

Post by MarkBoothmaa »

Hi,

I'm not very good with PowerShell so apologies in advance.
I'm trying to get a script to show the job name, description, # objects and the total backup size. This is just for VBR not cloud connect as I found cloud connect a lot easier to extract this information.
I need the description field as that contains some values we will use for billing.

I can get the 1st 3 items from get-vbrjob but cannot for the life of me work out how to then get the backup size added.
$job = Get-VBRJob
foreach($job in Get-VBRJob) { Write-Host "Client:", $job.Description, $job.Name; $job.GetObjectsInJob() | foreach { $_.Location } }

Any help for an old man :D is greatly appreciated.

Mark
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Script to show description along with # objects and backup size

Post by oleg.feoktistov » 1 person likes this post

Hi Mark,

To get backup size you would need to obtain backups for each job and then query backup storages (files), which are residing on a repo. That's where backup size and other stats are kept. Here is the entire script I used:

Code: Select all

 $jobs = Get-VBRJob
foreach ($job in $jobs) {
 $objects = Get-VBRJobObject -Job $job
 $backup = Get-VBRBackup -Name $($job.Name)
 $storages = $backup.GetAllChildrenStorages()
 $totalSize = 0
 foreach ($storage in $storages) {
   $totalSize += [Math]::Round($storage.Stats.BackupSize/1Gb, 1)
 }
 $job | select Name, Description, @{n='Objects';e={$objects.Name}}, @{n='BackupSize';e={$totalSize}} | fl
} 
Best regards,
Oleg
MarkBoothmaa
Veeam Legend
Posts: 181
Liked: 49 times
Joined: Mar 22, 2017 11:10 am
Full Name: Mark Boothman
Location: Darlington, United Kingdom
Contact:

Re: Script to show description along with # objects and backup size

Post by MarkBoothmaa »

Thank you Oleg that's perfect

Many Thanks
Mark
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests