-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Aug 02, 2016 11:58 am
- Full Name: RM4G00
- Contact:
Failed Job status - automatic retry ?
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
Does anyone have a sample of a powershell code to basically scan for eqstatus failed then if failed start job again ?
Thanks
RM4G00
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: Failed Job status - automatic retry ?
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-ba ... ml#p205116
powershell-f26/powershell-success-vm-ba ... ml#p205116
-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Aug 02, 2016 11:58 am
- Full Name: RM4G00
- Contact:
Re: Failed Job status - automatic retry ?
Thanks a lot Buddy I'll take a look
-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Aug 02, 2016 11:58 am
- Full Name: RM4G00
- Contact:
Re: Failed Job status - automatic retry ?
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
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Failed Job status - automatic retry ?
You can try this simple one-liner. It gets backup and replication jobs which latest session has Failed as its state and retry them:
Thanks.
Code: Select all
Get-VBRJob | where {$_.Jobtype -eq "Backup" -or $_.JobType -eq "Replica" -and $_.GetLastResult() -eq "Failed"} | Start-VBRJob -RetryBackup
-
- Enthusiast
- Posts: 39
- Liked: never
- Joined: Aug 02, 2016 11:58 am
- Full Name: RM4G00
- Contact:
Re: Failed Job status - automatic retry ?
As always v.eremin- thank you
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Failed Job status - automatic retry ?
As always, you're welcome. If additional help is needed, don't hesitate to let us know. Thanks.
Who is online
Users browsing this forum: No registered users and 11 guests