PowerShell script exchange
Post Reply
kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

Hello,
I followed few old forums to get the SOBR space used and free space but all the results I got were coming in bits or bytes and with V11 I was unable to get any, I really appreciate if someone can guide me to get that info using PowerShell commands or scripts.

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

Re: Fetching SOBR details in TB or GB through powershell

Post by oleg.feoktistov »

Hi Koushik,

In v11 we introduced some underlying achitectural changes for repositories, so some of the properties were moved, including space-related ones. You can find detailed explanation and ways to get them here. With SOBR space reporting I would do something like this:

Code: Select all

$sobrs = Get-VBRBackupRepository -Scaleout
$sobrReport = @()
foreach ($sobr in $sobrs) {
  $extents = $sobr.Extent
  $totalSpace = $null
  $totalFreeSpace = $null
  foreach ($extent in $extents) {
    $repo = $extent.Repository
    $container = $repo.GetContainer()
    $totalSpace += [Math]::Round($container.CachedTotalSpace.InMegabytes / 1024, 1)
    $totalFreeSpace += [Math]::Round($container.CachedFreeSpace.InMegabytes / 1024, 1)
  }
  $sobrReport += $sobr | select Name, @{n='TotalSpace';e={$totalSpace}}, `
  @{n='FreeSpace';e={$totalFreeSpace}}
}
$sobrReport
Keep in mind that I didn't use InGigabytes property in this case and wouldn't recommend it because an unobvious rounding factor takes place there. So, you might be off by few gigabytes in your final report. With InMegabytes values properly divided and rounded data in the final report corresponded to the space report in the UI in my case.

Best regards,
Oleg

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

Thanks a lot for sharing the script or the information, however when I run below code I do not see any output, do I have to add any output lines into the code to show me the output. Currently it does not give me error nor any output, please advise.

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

Re: Fetching SOBR details in TB or GB through powershell

Post by oleg.feoktistov »

Yep, all the results are in $sobrReport variable. I appended it to the end of the initial script so that the value is displayed. Thanks!

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

Thanks a lot Oleg I was able to get those details in TB after making few modifications, appreicate the help. How can I get the same data for cloud repositories info ?

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

Re: Fetching SOBR details in TB or GB through powershell

Post by oleg.feoktistov »

What do you mean by cloud repositories? Object storages hosted in the cloud or cloud repositories used in Cloud Connect functionality?

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

The Cloud Repository of Service Provider using Veeam Cloud Connect.

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

Hi Oleg,
Could you please let us know how can we pull the same information for Cloud repositories used in cloud connect functionality ?

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

Re: Fetching SOBR details in TB or GB through powershell

Post by oleg.feoktistov »

Hi,

If you need to obtain it from tenant's side, the approach is the one I shared above.
If from provider's side, here is an example:

Code: Select all

$tenants = Get-VBRCloudTenant
foreach ($tenant in $tenants) {
  $resources = $tenant.Resources
  foreach ($resource in $resources) {
  $resource | select RepositoryFriendlyName, RepositoryQuota, UsedSpace
}
}
Thanks,
Oleg

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

If I have to do it from the tenant side, do I have to change Scaleout in Get-VBRBackupRepository -Scaleout to cloud repository or any other thing ?

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

Re: Fetching SOBR details in TB or GB through powershell

Post by oleg.feoktistov »

Just use Get-VBRBackupRepository without -Scaleout parameter. Cloud repositories should be available in the output. Thanks!

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

I tried the same script without the -scaleout parameter and the output came in as empty but it listed out the repositories, please advise.
The output we get is as below

Name TotalSpace FreeSpace
---- ---------- ---------
Default Backup Repository
VCC_REPO001
Configuration Backups VCC

kpolsana
Novice
Posts: 8
Liked: never
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Re: Fetching SOBR details in TB or GB through powershell

Post by kpolsana »

$tenants = Get-VBRCloudTenant
foreach ($tenant in $tenants) {
$resources = $tenant.Resources
foreach ($resource in $resources) {
$resource | select RepositoryFriendlyName, RepositoryQuota, UsedSpace
}
}

for this script how can I get the result in TB or GB the same way as the scaleout repo's thanks a lot appreciate the help

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests