PowerShell script exchange
Post Reply
bteichner
Enthusiast
Posts: 30
Liked: 2 times
Joined: Apr 30, 2012 5:54 pm
Full Name: Brian Teichner
Contact:

Command line backup and retry

Post by bteichner »

One of our backups I'm running from a scheduled task with Veeam.Backup.Manager.exe (for scheduling purposes). The issue that I'm running into though, is if the backup fails it never runs a "retry job" like you can from the VBR console. Is there a way to set the number of retry attempts when initiating a backup job from the command line?
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Command line backup and retry

Post by Vitaliy S. »

This should be possible to do with PowerShell: http://forums.veeam.com/search.php?st=p ... d%5B%5D=26
bteichner
Enthusiast
Posts: 30
Liked: 2 times
Joined: Apr 30, 2012 5:54 pm
Full Name: Brian Teichner
Contact:

Re: Command line backup and retry

Post by bteichner »

So something like this should work in a powershell script:

Code: Select all

Start-VBRJob JobName -RetryBackup 1
I'd like to continue to use the windows scheduled task I have in place, and call the new powershell script instead.
Sethbartlett
Veteran
Posts: 282
Liked: 26 times
Joined: Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett
Contact:

Re: Command line backup and retry

Post by Sethbartlett »

Correct, this should work fine.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
andrew.proctor
Lurker
Posts: 2
Liked: 2 times
Joined: Mar 22, 2012 1:07 pm
Full Name: Andrew Proctor
Contact:

Re: Command line backup and retry

Post by andrew.proctor » 2 people like this post

I found this too with powershell. Here's how I got round it - the job will retry 3 times if it fails, waiting 8 minutes between each retry

Code: Select all

$job = Get-VBRJob -name $jobname
$jobtry = 0
start-VBRJob -job $job
if($job.GetLastResult() -eq "Failed"){
    do{
        Start-Sleep 480
        Start-VBRJob -job $job -RetryBackup
        $jobtry++
    }
    while(($jobtry -lt 3) -and ($job.GetLastResult() -eq "Failed"))
}
}
I use it as part of a slightly longer script that chains my jobs together so they run consecutively and it seems to work well. Hope this helps.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests