PowerShell script exchange
Post Reply
ratkinsonuk
Expert
Posts: 114
Liked: 16 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Trying to get a list of restore points including their location

Post by ratkinsonuk »

I have a Powershell based report that been around for a number of years. It lists the Veeam backup, then the servers in the backup and finally the restore points for each server.

I'm trying to enhance the report by showing which RP's are on-prem and which are in the S3 part of the SOBR.

Code: Select all

    # Build an array of the restore points
    $BackupRestorePoints = Get-VBRRestorePoint -Backup $JobName

    $ArrayRestorePoints = @()

    foreach ($RestorePoint in $BackupRestorePoints) {
        $ArrayRestorePoint = New-Object -TypeName PSObject
        $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "VmName" -Value $RestorePoint.VmName
        $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "CreationTime" -Value $RestorePoint.CreationTime
        $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "Type" -Value $RestorePoint.Type
        
        $RestorePoint.GetChainStorages() | select iscontentinternal,iscontentexternal

        if ($RestorePoint.GetChainStorages().IsContentExternal) {
            $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "Offsite" -Value "AWS S3"
        } else {
            $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "Offsite" -Value ""
        }

        $ArrayRestorePoints += $ArrayRestorePoint
    }
The problem I've found is the IsContentInternal is false if there's a copy in the cloud. I can't find any other property that allow me to work out what's local and what's remote.

I've also tried Get-VBRSOBRObjectStorageRestorePoint, but as that selects by the server name and not the backup job, it's not always returning the correct data in terms of the backup that created the file (assuming the same server is backed up in more than one job).

Anyone know of a hard-to-find property somewhere that definitively tells me where the physical backup file is stored?

Cheers, Rob
david.domask
Veeam Software
Posts: 2325
Liked: 554 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Trying to get a list of restore points including their location

Post by david.domask »

Hi Robert,

Get-VBRSOBRObjectStorageRestorePoint has some limitations right now in that it's only meant for passing data to Remove-VBRRestorePoint in the current version; this is planned to be extended in future releases.

For right now, a few ways I can think of doing this, since with Copy there is some special handling with the restore point data that makes it not so clear always to get this data.

1. Since it's copy, you can just use Group-Object on the points returned from Get-VBRSOBRObjectStorageRestorePoint on the BackupID property and match it to the Performance Tier backup restore points (get the backup with Get-VBRBackup, then pass the CBackup object to Get-VBRRestorePoints on the -Backup property) -- as it's Copy, you should be able to just compare the results and they should be equal.

2. Integrate the workaround from this thread into your code -- I did a quick check on it and looks to work on 12.1.2.172 when I tested just now.

Give it a shot and see if either works for you.
David Domask | Product Management: Principal Analyst
ratkinsonuk
Expert
Posts: 114
Liked: 16 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Re: Trying to get a list of restore points including their location

Post by ratkinsonuk » 1 person likes this post

David, I've been playing with Option 1, but it takes forever to return from the call and then just gives errors that the backup can't be found.

However FindStorage().Info does appear to return a flag showing when the backup is still on-prem.

Code: Select all

        $StorageInfo = $RestorePoint.FindStorage().Info

        if ($StorageInfo.ExternalContentMode -eq "Internal") {
            $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "Offsite" -Value ""
        } else {
            $ArrayRestorePoint | Add-Member -MemberType NoteProperty -Name "Offsite" -Value "AWS S3"
        }
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests