PowerShell script exchange
Post Reply
AdrianHinton
Enthusiast
Posts: 71
Liked: 6 times
Joined: Apr 07, 2014 10:00 am
Full Name: Adrian Hinton
Contact:

Accessing Retention options using Powershell

Post by AdrianHinton »

Hi all,

The variable $Jobs = Get-VBRJob and now contains all configured jobs on my server. I want to get at the GFS options on a BackupSync job, one of which happens to be the third element in the $Jobs variable. Below is how I have accessed this data and underneath are the returned properties:

$Jobs[2].Options.Options.RootNode.FirstChild

RecoveryPointObjectiveValue
RecoveryPointObjectiveUnit
SyncIntervalStartTime
RetentionPolicyType
SimpleRetentionRestorePoints
KeepGfsBackups
GFSRecentPoints
GFSMonthlyBackups
GFSWeeklyBackups
GFSQuarterlyBackups
GFSYearlyBackups
WeeklyBackupDayOfWeek
WeeklyBackupTime
MonthlyBackupCreationTime
QuarterlyBackupCreationTime
YearlyBackupCreationTime
EnableDeletedVmDataRetention
DeletedVmsDataRetentionPeriodDays
CompactMonthlyScheduleOptions
EnableCompactFull
CompactFullBackupScheduleKind
RecheckMonthlyScheduleOptions
EnableRecheck
RecheckScheduleKind
CompactFullBackupDays
RecheckDays

Could you tell me the alternative ways (if any) to get at these values?

Thank you.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Accessing Retention options using Powershell

Post by veremin » 1 person likes this post

The information about GFS generation policy is also available under GetOptions().GenerationPolicy.

Code: Select all

$Job = Get-VBRJob -name "Name of your backup Copy Job"
$Options = $Job.GetOptions()
$Options.GenerationPolicy
Thanks.
ldasilva
Novice
Posts: 5
Liked: never
Joined: Apr 25, 2017 5:43 pm
Full Name: Lisandro da Silva
Contact:

Check retention policy in powershell

Post by ldasilva »

Hi,

Can anyone help me out?

I'm trying to query the retention policy of backup copy jobs using powershell.

$Job = Get-VBRJob -name "jobname"
$Options = $Job.GetOptions()
$Options.GenerationPolicy


How can i use the command $options.GenerationPolicy to only show me the GFSyearlybackups

Thank you


GFSRecentPoints : 2
GFSWeeklyBackups : 4
GFSMonthlyBackups : 12
GFSQuarterlyBackups : 0
GFSYearlyBackups : 10
GFSIsReadEntireRestorePoint : False
WeeklyBackupDayOfWeek : Sunday
WeeklyBackupTime : 22:00:00
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests