-
- Influencer
- Posts: 11
- Liked: 2 times
- Joined: Oct 07, 2015 12:28 pm
- Full Name: ATI Helpdesk
- Contact:
Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
On Veeam 9.5 I used [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id) to get the repository used space--which I need for a billing script I've written in Powershell. After updating to Veeam 10, it appears GetRepositoryStoragesSize is no longer a member of Veeam.Backup.Core.CbackupRepository. Anyone know how to get the USED SPACE column value from the Backup Repositories page using Powershell?
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
It's now container under the Info property. Example for my repo titled 'ReFs-PerVM'
GUI for comparison:
Code: Select all
$repo = Get-VBRBackupRepository -Name ReFS-PerVM
$repo.Info.CachedFreeSpace / 1GB
171.453430175781
$repo.Info.CachedTotalSpace / 1TB
1.17169189453125
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
-
- Influencer
- Posts: 11
- Liked: 2 times
- Joined: Oct 07, 2015 12:28 pm
- Full Name: ATI Helpdesk
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
jhoughes,
Thank you. Alas, subtracting those two values does not give you the USED SPACE column value from the BACKUP INFRASTRUCTURE/Backup Repositories page in the B&R Console. Subtracting those two does give you the amount of space used on the repository storage device. USED SPACE is the amount of space that would be used on a storage device if you restored all of the backed up entities stored in the repository--which is what my billing department wants.
Thank you. Alas, subtracting those two values does not give you the USED SPACE column value from the BACKUP INFRASTRUCTURE/Backup Repositories page in the B&R Console. Subtracting those two does give you the amount of space used on the repository storage device. USED SPACE is the amount of space that would be used on a storage device if you restored all of the backed up entities stored in the repository--which is what my billing department wants.
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Apologies, my draft got posted by accident while I switched to another task.
The free & capacity space details are now contained under the Info property. Example for my repo titled 'ReFs-PerVM':
GUI for comparison:
To get the Used Space size, we have to do some calculation on the backup size of the storage files. This can take a while depending on the size of your repository and backup chains.
This returns a bit less than the GUI due to rounding.
The free & capacity space details are now contained under the Info property. Example for my repo titled 'ReFs-PerVM':
Code: Select all
$repo = Get-VBRBackupRepository -Name ReFS-PerVM
$repo.Info.CachedFreeSpace / 1GB
171.453430175781
$repo.Info.CachedTotalSpace / 1TB
1.17169189453125
To get the Used Space size, we have to do some calculation on the backup size of the storage files. This can take a while depending on the size of your repository and backup chains.
Code: Select all
$repo = Get-VBRBackupRepository -Name ReFS-PerVM
$backups = $repo.GetBackups()
$storages = $backups.GetAllStorages()
($storages.stats | Measure-Object -Property backupsize -sum | Select -ExpandProperty Sum) /1TB
1.48376941680908
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
-
- Influencer
- Posts: 11
- Liked: 2 times
- Joined: Oct 07, 2015 12:28 pm
- Full Name: ATI Helpdesk
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
jhoughes,
Thank you very much. That does indeed return the value I need. Your quick reply gets some pressure off me, which I do not need.
Thank you very much. That does indeed return the value I need. Your quick reply gets some pressure off me, which I do not need.
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Sounds good, I'm glad that it helps you out.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
-
- Influencer
- Posts: 11
- Liked: 2 times
- Joined: Oct 07, 2015 12:28 pm
- Full Name: ATI Helpdesk
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
While not a problem for me right now, this method does not appear to work with scale-out repositories. Neither the repository nor the extents have a GetBackup() method. I will work on that later but, however, if someone has a quick answer, I would be appreciative.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
If I remember correctly, Extent object should contain a Repository as a parameter. So, you should be able to access underlying repository as well as its method GetBackups method.
$Extent.Repository.GetBackups()
Thanks!
$Extent.Repository.GetBackups()
Thanks!
-
- Influencer
- Posts: 11
- Liked: 2 times
- Joined: Oct 07, 2015 12:28 pm
- Full Name: ATI Helpdesk
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
veremin,
Thank you. I tried your method and; It did not return an error but, it also did not return any records.
Here it the method I figured out:
# Get a list of all backups and select only those whose repository name matches the scale-out repo I want ( $r )
# Notice it is using the GetRepositoryName() method in the Where clause ( sometimes I love Powershell )
$backups = Get-VBRBackup | Where-Object {$_.GetRepositoryName() -eq $r}
# get all the storage records used by the backups
$storages = $backups.GetAllStorages()
# sum the storage records backupsize property
# unlike jhoughes, I am returning the number in bytes. it is divided by 1Tb later in the script
$uspace = $storages.stats | Measure-Object -Property backupsize -sum | Select -ExpandProperty Sum
Thanks to everyone for the help
Thank you. I tried your method and; It did not return an error but, it also did not return any records.
Here it the method I figured out:
# Get a list of all backups and select only those whose repository name matches the scale-out repo I want ( $r )
# Notice it is using the GetRepositoryName() method in the Where clause ( sometimes I love Powershell )
$backups = Get-VBRBackup | Where-Object {$_.GetRepositoryName() -eq $r}
# get all the storage records used by the backups
$storages = $backups.GetAllStorages()
# sum the storage records backupsize property
# unlike jhoughes, I am returning the number in bytes. it is divided by 1Tb later in the script
$uspace = $storages.stats | Measure-Object -Property backupsize -sum | Select -ExpandProperty Sum
Thanks to everyone for the help
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Yeah, I figured that as well, then, either your script or the one provided Joe (that uses CachedFreeSpace values) should be a way to go. Thanks!
-
- Service Provider
- Posts: 11
- Liked: 3 times
- Joined: Apr 19, 2018 8:01 am
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Hi all
I found that this worked for me and give the same results as in the console.
[Veeam.Backup.Core.CBackupRepository]::GetRepositoryBackupsSize($repository.Id.Guid)
I found that this worked for me and give the same results as in the console.
[Veeam.Backup.Core.CBackupRepository]::GetRepositoryBackupsSize($repository.Id.Guid)
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Happy to hear you've found the different approach, and even happier that you've shared it with the community; much appreciated!
-
- Influencer
- Posts: 13
- Liked: 5 times
- Joined: Mar 21, 2017 3:51 pm
- Full Name: cferilli
- Contact:
Re: Veeam 10 [Veeam.Backup.Core.CbackupRepository]::GetRepositoryStoragesSize($repo.Id)
Very interesting topic, I was searching for a similar solution, now I got it
Thanks to all !
Thanks to all !
Who is online
Users browsing this forum: No registered users and 6 guests