PowerShell script exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 7076
Liked: 1510 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Post Job Cmd - Run only if job ends with success / warning

Post by Andreas Neufert » 1 person likes this post

Hi
I added the script from v.Eremin here to link it better to the "Getting Started and Code Examples"

If you try to run a post Job script only if Job Ends with "success" or "warning",
you can use a powershell script as post Job command (started by a normal cmd) to check if Job Ends the right way:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your job"
If ($job.GetLastresult() -eq "Warning" -or $job.GetLastresult() -eq "Success")
{
Place your commands here that you want to start
} Else {}
veremin
Product Manager
Posts: 20400
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Post Job Cmd - Run only if job ends with success / warni

Post by veremin » 1 person likes this post

You’re welcome. Glad to hear that the posted script proved to be useful.

Thanks.
Andreas Neufert
VP, Product Management
Posts: 7076
Liked: 1510 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: Post Job Cmd - Run only if job ends with success / warni

Post by Andreas Neufert »

Hi Vladimir,
thanks for your answer.
because of my fully booked calendar I added only the things I used at daily business to the example topic.
I hope that I can add more content here after v7 beta/release.
If you see or have other good code examples, please add it to the "example" topic or send me a link and I will add them.

Thanks again Vladimir... Andy
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 19 guests