PowerShell script exchange
Post Reply
Jimmy9008
Influencer
Posts: 11
Liked: never
Joined: May 10, 2019 9:48 am
Full Name: Jimmy Grollman
Contact:

Archive Backups - How to verify they exist?

Post by Jimmy9008 »

Hi folks,

I have a backup job with the 'Keep certain full backups longer for archival purposes' selected, with 'Keep monthly full backups for 12 months' set.

I have been running this for two months now, how can I verify the end of month last backup is marked as archive? I can see them in the chain, but I cannot see any note/mark that says they are archive...

How do I verify these are marked as archive?

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

Re: Archive Backups - How to verify they exist?

Post by oleg.feoktistov »

Hi Jimmy,

In the UI:
Right click on a backup in Backups node and select Properties. Restore points with GFS flags should be reflected with the corresponding letter under Retention column (W - weekly, M - monthly, Y - yearly). The View should look exactly as in this guide.

In Powershell:

Code: Select all

asnp VeeamPSSnapin
$backup = Get-VBRBackup -Name 'BackupName'
$restorepoints = Get-VBRRestorepoint -Backup $backup

#create empty guid as the method below takes backupId to exclude as a required parameter.
[guid]$guid = '00000000-0000-0000-0000-000000000000'

#get GFS candidates for the backup chosen. Pass empty guid as an argument to make sure nothing is excluded.
$objects = $backup.GetGfsCandidateStorageGroups($guid)
foreach ($object in $objects) {
    $object.Candidates | select StorageFileName, CreationTimeUtc, Flags
} 

Powershell code returns both restore points with GFS flags and future candidates for assignment.
To render only those with flags assigned amend the line in the loop accordingly:

Code: Select all

 $object.Candidates | where {$_.Flags -ne 'None'} | select StorageFileName, CreationTimeUtc, Flags 
Best regards,
Oleg
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Archive Backups - How to verify they exist?

Post by oleg.feoktistov »

Seems like excludedPointId is ignored inside GetGfsCandidateStorageGroups() method after all, but still is required.
So, you might as well pass $backup.Id instead:

Code: Select all

$objects = $backup.GetGfsCandidateStorageGroups($backup.Id)
Cheers!
Jimmy9008
Influencer
Posts: 11
Liked: never
Joined: May 10, 2019 9:48 am
Full Name: Jimmy Grollman
Contact:

Re: Archive Backups - How to verify they exist?

Post by Jimmy9008 »

Perfect, got it! Cheers.
whzbk
Lurker
Posts: 2
Liked: never
Joined: Nov 22, 2021 7:42 am
Contact:

Re: Archive Backups - How to verify they exist?

Post by whzbk »

Hello,

i am trying this:

Code: Select all

$backup = Get-VBRBackup -Name "myBackup"
$restorepoints = Get-VBRRestorepoint -Backup $backup
$objects = $backup.GetGfsCandidateStorageGroups($backup.Id)
but then i get this error:

Code: Select all

Cannot find an overload for "GetGfsCandidateStorageGroups" and the argument count: "1".
At line:1 char:1
+ $objects = $backup.GetGfsCandidateStorageGroups($backup.Id)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

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

Re: Archive Backups - How to verify they exist?

Post by oleg.feoktistov »

Hi,

Yep, looks like in 11a the signature of GetGfsCandidateStorageGroups() method changed. Now it gets current backup id automatically and requires guid excludedPointId along with includeCorrupted boolean. I used this example with zeroed guid to make sure nothing is excluded:

Code: Select all

$backup = Get-VBRBackup -Name 'BackupName'
$guid = '00000000-0000-0000-0000-000000000000'
$backup.GetGfsCandidateStorageGroups($guid, $false)
Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests