Backup COpy Job Change Copy Every Starting at

PowerShell script exchange

Backup COpy Job Change Copy Every Starting at

Veeam Logoby sidavid » Sun 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
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: Backup COpy Job Change Copy Every Starting at

Veeam Logoby tsightler » Sun 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.
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Backup COpy Job Change Copy Every Starting at

Veeam Logoby sidavid » Mon Oct 28, 2013 12:54 am

Just Perfect!!, YES

Many thanks
sidavid
Enthusiast
 
Posts: 60
Liked: never
Joined: Sun Jan 01, 2006 1:01 am


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests