PowerShell script exchange
Post Reply
kpolsana
Service Provider
Posts: 56
Liked: 2 times
Joined: Dec 10, 2021 6:35 pm
Full Name: Koushik Polsana
Contact:

Fetching SOBR details in TB or GB through powershell

Post by kpolsana » 1 person likes this post

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: 1912
Liked: 635 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
Service Provider
Posts: 56
Liked: 2 times
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: 1912
Liked: 635 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
Service Provider
Posts: 56
Liked: 2 times
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: 1912
Liked: 635 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
Service Provider
Posts: 56
Liked: 2 times
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
Service Provider
Posts: 56
Liked: 2 times
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: 1912
Liked: 635 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
Service Provider
Posts: 56
Liked: 2 times
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: 1912
Liked: 635 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
Service Provider
Posts: 56
Liked: 2 times
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
Service Provider
Posts: 56
Liked: 2 times
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
kpolsana
Service Provider
Posts: 56
Liked: 2 times
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 »

Hello Oleg, Checking in to see if you have an update on the request. Thanks
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 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,

About the very same script for SOBR repositories. You also need to get rid of SOBR extents queries and obtain repository containers directly. Like that:

Code: Select all

$repos = Get-VBRBackupRepository 
$repoReport = @()
foreach ($repo in $repos) {
  $container = $repo.GetContainer()
  $totalSpace += [Math]::Round($container.CachedTotalSpace.InMegabytes / 1024, 1)
  $totalFreeSpace += [Math]::Round($container.CachedFreeSpace.InMegabytes / 1024, 1)
  $repoReport += $repo | select Name, @{n='TotalSpace';e={$totalSpace}}, `
  @{n='FreeSpace';e={$totalFreeSpace}}
}
$repoReport
About cloud tenant's side script. Looks like the sizes there are reflected in megabytes only. So you'd need to divide them to get TB and GB.

Thanks,
Oleg
kpolsana
Service Provider
Posts: 56
Liked: 2 times
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 Object storage as primary SOBR not an offloading one how can I get size of it, when I ran the below commands it gave me 0

$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

{
"Name": "SOBR001",
"TotalSpace": 1023.9,
"FreeSpace": 954.9
},
{
"Name": "WAS-SOBR001",
"TotalSpace": 0,
"FreeSpace": 0
}
kpolsana
Service Provider
Posts: 56
Liked: 2 times
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 »

How can I use the following code to get the repositories info as well
$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

I tried the following code but it does not give the info other than the default backup

$repos = Get-VBRBackupRepository
$repoReport = @()
foreach ($repo in $repos) {
$container = $repo.GetContainer()
$totalSpace += [Math]::Round($container.CachedTotalSpace.InMegabytes / 1024, 1)
$totalFreeSpace += [Math]::Round($container.CachedFreeSpace.InMegabytes / 1024, 1)
$repoReport += $repo | select Name, @{n='TotalSpace';e={$totalSpace}}, `
@{n='FreeSpace';e={$totalFreeSpace}}
}
$repoReport
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests