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 » May 10, 2014 12:23 am

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: 16691
Liked: 1394 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Accessing Retention options using Powershell

Post by veremin » May 12, 2014 8:41 am 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 » Jul 07, 2017 3:12 pm

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: sammt and 5 guests