PowerShell script exchange
Post Reply
lrhazi
Enthusiast
Posts: 94
Liked: 3 times
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

How to check if a restore point is in capacity tier?

Post by lrhazi »

Is there way to figure this out, after something like this:

Code: Select all

$rp = (Get-VBRBackup -Name $backup_name| Get-VBRRestorePoint -Name $VM_NAME| Sort-Object –Property CreationTime | Select-Object -First 1)
Thanks,
Mohamed.
chris.arceneaux
VeeaMVP
Posts: 668
Liked: 359 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: How to check if a restore point is in capacity tier?

Post by chris.arceneaux » 1 person likes this post

Hi Mohamed,

Please see below for sample code:

Code: Select all

$rps = Get-VBRBackup -Name "<backup-name>" | Get-VBRRestorePoint -Name "<vm-name>" | Sort-Object -Property CreationTime
foreach ($rp in $rps){
  $backupFile = $rp.GetRestoreStorages() | Select-Object -First 1
  $rp | Select-Object VmName,CreationTime,Type,@{Name='Local';Expression={$backupFile.IsContentInternal}},@{Name='CapacityTier';Expression={$backupFile.IsContentExternal}},@{Name='ArchiveTier';Expression={$backupFile.IsContentFrozen}}
}
Sample output:

Image
lrhazi
Enthusiast
Posts: 94
Liked: 3 times
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

Re: How to check if a restore point is in capacity tier?

Post by lrhazi »

Thanks a lot!!!
barrett27
Enthusiast
Posts: 34
Liked: 4 times
Joined: May 18, 2022 1:58 pm
Contact:

[MERGED] Determining if a restore point has been copied to capacity tier

Post by barrett27 »

Hello,
I have my backup jobs that save data using a SOBR and I would list the restore points that are on the performance tier but have not yet copied to the capaciy tier (S3 compatible object storage).

I used Get-VBRRestorePoint, but I can't find a property could say something like "isOnCapacityTier:false"

Maybe using other commands?

Thank you

db
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: How to check if a restore point is in capacity tier?

Post by HannesK »

Hello,
forum search brought up the answer above... does that help?

Best regards,
Hannes
barrett27
Enthusiast
Posts: 34
Liked: 4 times
Joined: May 18, 2022 1:58 pm
Contact:

Re: How to check if a restore point is in capacity tier?

Post by barrett27 »

Hello Hannes,
thank you for your reply
I tried with a restore point that is surely both on capacity and performance tier, but isContentExternal says "False"


IsContentInternal : True
IsContentExternal : False

db
barrett27
Enthusiast
Posts: 34
Liked: 4 times
Joined: May 18, 2022 1:58 pm
Contact:

Re: How to check if a restore point is in capacity tier?

Post by barrett27 »

I just realized that some restore point that are on a different object storage (IBM), have isContentExternal that says "True"

The one where I have isContentExternal that says "False" is a compatible s3 object storage

So the value of that property depends on the Object Storage vendor?

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

Re: How to check if a restore point is in capacity tier?

Post by oleg.feoktistov » 1 person likes this post

Hi,

No, that's not the case. IsContentInternal is True together with IsContentExternal is False in two cases: if a storage indeed resides locally and if a storage has been offloaded to capacity tier in scope of SOBR copy policy. In the second case storages copied to capacity won't be reflected because internally they are already referenced by original storages that stayed locally. What you can do with it is check whether local storages have shadow copies. In case with copied backups they will reflect exactly what you want - storages copied to capacity tier. For example:

Code: Select all

$rps = Get-VBRBackup -Name 'Backup' | Get-VBRRestorePoint| Sort-Object -Property CreationTime

$storages = @()
foreach ($rp in $rps){
  $storage = $rp.GetStorage()
  $storages += $storage | select @{n='VMName';e={$rp.VmName}}, @{n='CreationTime';e={$storage.CreationTime}}, `
  @{n='Type';e={$rp.Type}}, @{n='Local';e={$storage.IsContentInternal}}, `
  @{n='CapacityTier';e={$storage.IsContentExternal}}, @{n='ArchiveTier';e={$storage.IsContentFrozen}}, @{n='IsCopied';e={$false}}
  if ($storage.IsContentExternal -eq $false) {
  
  try {
  $shadowStorage = [Veeam.Backup.Core.CStorage]::GetShadowStorageByOriginalStorageId($storage.Id, $false)
  $storages += $shadowStorage | select @{n='VMName';e={$rp.VmName}}, @{n='CreationTime';e={$shadowStorage.CreationTime}}, `
  @{n='Type';e={$rp.Type}}, @{n='Local';e={$shadowStorage.IsContentInternal}}, `
  @{n='CapacityTier';e={$shadowStorage.IsContentExternal}}, @{n='ArchiveTier';e={$shadowStorage.IsContentFrozen}}, `
  @{n='IsCopied';e={$true}}

  }
  catch [System.Management.Automation.MethodInvocationException] {
    continue
  }
  }
}
$storages | ft
In the sample script above I composed and used IsCopied dynamic property as an indicator for offload type.

Hope it helps,
Oleg
barrett27
Enthusiast
Posts: 34
Liked: 4 times
Joined: May 18, 2022 1:58 pm
Contact:

Re: How to check if a restore point is in capacity tier?

Post by barrett27 »

Hello Oleg,
What you can do with it is check whether local storages have shadow copies
Do you mean shadow copies on the local disks of the performance tier where backup files resides? Or shadow copies on the guest OS?

I tried your script and it works with some VM backups, not with others
Thank you very much for the help

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

Re: How to check if a restore point is in capacity tier?

Post by oleg.feoktistov »

Hi,

I mean shadow copies of the backup files that reside on performance tier.
Can you, please, let me know in which cases the script didn't work?

Thanks,
Oleg
barrett27
Enthusiast
Posts: 34
Liked: 4 times
Joined: May 18, 2022 1:58 pm
Contact:

Re: How to check if a restore point is in capacity tier?

Post by barrett27 »

Hi,
after a long time I needed again to do this check, and I tried again your script and it works... so I was wrong, my mistake.

Your script creates two objects for every single restore point (one for the local and another one for the capacity), so I changed it a little bit to have the informations in a single object:

Code: Select all

$restorepointall = Get-VBRBackup | Get-VBRRestorePoint| Sort-Object -Property CreationTime
$storages = @()
foreach ($restorepoint in $restorepointall){
    $storage = $restorepoint.GetStorage()
    $VMName = $restorepoint.VMName
    $Type = $restorepoint.Type
    $CreationTime = $storage.CreationTime
    $IsLocal = $storage.IsContentInternal
    $CapacityTier = $storage.IsContentExternal
    $ArchiveTier = $storage.IsContentFrozen
    $IsCopied = $false
    if ($storage.IsContentExternal -eq $false) {
        try {
            $shadowStorage = [Veeam.Backup.Core.CStorage]::GetShadowStorageByOriginalStorageId($storage.Id, $false)
            $CreationTime = $shadowStorage.CreationTime
            $IsLocal = $shadowStorage.IsContentInternal
            $CapacityTier = $shadowStorage.IsContentExternal
            $ArchiveTier = $shadowStorage.IsContentFrozen
            $IsCopied = $true
        }
          catch [System.Management.Automation.MethodInvocationException] {
            continue
          }
          finally {
            #$storageobj = [PSCustomObject]@{
            [PSCustomObject]@{
                VMName = $VMName
                Type = $Type
                CreationTime = $CreationTime
                IsLocal = $IsLocal
                CapacityTier = $CapacityTier
                ArchiveTier = $ArchiveTier
                IsCopied = $IsCopied
            }
            $storages += $storageobj
        }
        }
    }    
Now I don't understand why if I move backups from the performance to the capacity tier, the script still says that they are local. Maybe I need to query other objects or storage properties?

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

Re: How to check if a restore point is in capacity tier?

Post by oleg.feoktistov »

Hi,

Do you see the backups you moved to capacity tier if you just query storages with IsContentExternal set to true?

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests