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

PowerShell script exchange

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

Veeam Logoby Andreas Neufert » Mon 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 {}
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

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

Veeam Logoby v.Eremin » Mon 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.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

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

Veeam Logoby Andreas Neufert » Mon 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
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 13 guests