PowerShell script exchange
Post Reply
sidavid
Enthusiast
Posts: 63
Liked: 1 time
Joined: Jan 01, 2006 1:01 am
Contact:

Backup COpy Job Change Copy Every Starting at

Post by sidavid » Oct 27, 2013 3:55 pm

Hi,

How can I change the Copy Every starting at setting in a Backup Copy Job:

Get-VBRJob -Name OFFSITE-DAILY* | foreach {
$vbrjobname = $_.Name
Write-Host $vbrjobname
Change the Copy Starting at 4:00PM
}

Thanks

tsightler
VP, Product Management
Posts: 5421
Liked: 2243 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Backup COpy Job Change Copy Every Starting at

Post by tsightler » Oct 27, 2013 6:57 pm

Backup Copy jobs run in continuous mode which makes working with their scheduling a little different than regular backup jobs. You cannot make changes to them unless the job is disabled. Also, setting the interval start time is a little interesting as it is defined as a timespan object that indicates the amount of time from midnight. That being said, once you understand these concepts it's actually fairly simple. In the example below I've taken your initial code and modified it to use the Powershell New-TimeSpan cmdlet to create a new timespan object that sets the interval start time to 4:00PM (16 after midnight). Obviously you can change this by simply modifying the second parameter of the New-TimeSpan cmdlet that sets the IntervalStart variable.

Code: Select all

# Calculate new interval value using timespan from midnight
$IntervalStart = New-TimeSpan (Get-Date -Hour 0 -Minute 0 -Second 0) (Get-Date -Hour 16 -Minute 0 -Second 0)

Get-VBRJob -Name "OFFSITE-DAILY*" | foreach {
   Write-Host $_.Name
   # Disable the Job
   $_.DisableScheduler()
   # Wait for the job to actually stop
   while (!$_.IsStopped()) {}
   $Options = $_.Options
   $Options.GenerationPolicy.SyncIntervalStartTime = $IntervalStart
   $_.SetOptions($Options)
   $_.EnableScheduler()
}
I hope this makes sense, please feel free to ask for any clarifications.

sidavid
Enthusiast
Posts: 63
Liked: 1 time
Joined: Jan 01, 2006 1:01 am
Contact:

Re: Backup COpy Job Change Copy Every Starting at

Post by sidavid » Oct 28, 2013 12:54 am

Just Perfect!!, YES

Many thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests