PowerShell script exchange
Post Reply
Andreas Neufert
Veeam Software
Posts: 3701
Liked: 652 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 » May 13, 2013 9:26 am 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: 16666
Liked: 1390 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 » May 13, 2013 9:34 am 1 person likes this post

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

Thanks.

Andreas Neufert
Veeam Software
Posts: 3701
Liked: 652 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 » May 13, 2013 9:53 am

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: No registered users and 4 guests