Failed Job status - automatic retry ?

PowerShell script exchange

Failed Job status - automatic retry ?

Veeam Logoby rm4g00 » Sun Sep 18, 2016 7:13 pm

Hello all,

Does anyone have a sample of a powershell code to basically scan for eqstatus failed then if failed start job again ?


Thanks

RM4G00
rm4g00
Enthusiast
 
Posts: 32
Liked: never
Joined: Tue Aug 02, 2016 11:58 am
Full Name: RM4G00

Re: Failed Job status - automatic retry ?

Veeam Logoby tsightler » Mon Sep 19, 2016 1:24 am

The post below has some code I put together that basically does this by looking for failed jobs and then retries. It should give you an idea of ways to do what you are asking.

powershell-f26/powershell-success-vm-backuo-not-job-t36923.html#p205116
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Failed Job status - automatic retry ?

Veeam Logoby rm4g00 » Mon Sep 19, 2016 6:57 am

Thanks a lot Buddy I'll take a look :)
rm4g00
Enthusiast
 
Posts: 32
Liked: never
Joined: Tue Aug 02, 2016 11:58 am
Full Name: RM4G00

Re: Failed Job status - automatic retry ?

Veeam Logoby rm4g00 » Mon Sep 19, 2016 11:40 am

Can you just set this to look for the last result most recent as I think this will search for every failed task- basically all I'm looking for is to run a task scheduler to look for last result = failed then retry something simple
rm4g00
Enthusiast
 
Posts: 32
Liked: never
Joined: Tue Aug 02, 2016 11:58 am
Full Name: RM4G00

Re: Failed Job status - automatic retry ?

Veeam Logoby v.Eremin » Mon Sep 19, 2016 1:30 pm

You can try this simple one-liner. It gets backup and replication jobs which latest session has Failed as its state and retry them:

Code: Select all
Get-VBRJob | where {$_.Jobtype -eq "Backup" -or $_.JobType -eq "Replica" -and $_.GetLastResult() -eq "Failed"} | Start-VBRJob -RetryBackup


Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Failed Job status - automatic retry ?

Veeam Logoby rm4g00 » Mon Sep 19, 2016 7:54 pm

As always v.eremin- thank you :)
rm4g00
Enthusiast
 
Posts: 32
Liked: never
Joined: Tue Aug 02, 2016 11:58 am
Full Name: RM4G00

Re: Failed Job status - automatic retry ?

Veeam Logoby v.Eremin » Tue Sep 20, 2016 9:45 am

As always, you're welcome. :) If additional help is needed, don't hesitate to let us know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: edirschedl and 7 guests